77 lines
1.9 KiB
C
77 lines
1.9 KiB
C
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||
|
|
||
|
#ifndef _XFORK_H
|
||
|
#define _XFORK_H
|
||
|
|
||
|
struct mm_struct;
|
||
|
struct vm_area_struct;
|
||
|
|
||
|
#ifdef CONFIG_XFORK
|
||
|
#define get_xfork_mm(mm) ((struct mm_struct *)(mm->kabi_reserved1))
|
||
|
#define set_xfork_mm(mm, val) (mm->kabi_reserved1 = (unsigned long)val)
|
||
|
|
||
|
#define get_xfork_vma(vma) ((struct vm_area_struct *)(vma->kabi_reserved1))
|
||
|
#define set_xfork_vma(vma, val) (vma->kabi_reserved1 = (unsigned long)val)
|
||
|
int memcg_xfork_enable(struct task_struct *p);
|
||
|
|
||
|
int xfork_quick_copy_page_range(struct vm_area_struct *dst_vma,
|
||
|
struct vm_area_struct *src_vma);
|
||
|
|
||
|
bool pmd_wrprotect_by_xfork(pmd_t pmd);
|
||
|
|
||
|
void xfork_fixup_pmd(struct vm_area_struct *mpnt, pmd_t *pmd, unsigned long addr);
|
||
|
|
||
|
void xfork_wait_vma_copy_done(struct vm_area_struct *vma);
|
||
|
|
||
|
void xfork_copy_update(void);
|
||
|
|
||
|
void xfork_copy_cleanup(struct mm_struct *mm);
|
||
|
|
||
|
void xfork_copy_handshake(struct mm_struct *parent, struct mm_struct *child, int val);
|
||
|
#else
|
||
|
#define get_xfork_mm(mm) do { } while (0)
|
||
|
#define set_xfork_mm(mm, val) do { } while (0)
|
||
|
|
||
|
#define get_xfork_vma(vma) do { } while (0)
|
||
|
#define set_xfork_vma(vma, val) do { } while (0)
|
||
|
static inline int __maybe_unused memcg_xfork_enable(struct task_struct *p)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static inline int __maybe_unused xfork_quick_copy_page_range(struct vm_area_struct *dst_vma,
|
||
|
struct vm_area_struct *src_vma)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static bool __maybe_unused pmd_wrprotect_by_xfork(pmd_t pmd)
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
static inline void __maybe_unused xfork_fixup_pmd(struct vm_area_struct *mpnt,
|
||
|
pmd_t *pmd, unsigned long addr)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
static inline void __maybe_unused xfork_wait_vma_copy_done(struct vm_area_struct *vma)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
static inline void __maybe_unused xfork_copy_update(void)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
static inline void __maybe_unused xfork_copy_cleanup(struct mm_struct *mm)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
static void __maybe_unused xfork_copy_handshake(struct mm_struct *parent,
|
||
|
struct mm_struct *child, int val)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
#endif
|