4 * Memory merging support.
6 * This code enables dynamic sharing of identical pages found in different
7 * memory areas, even if they are not shared by fork().
10 #include <linux/bitops.h>
12 #include <linux/sched.h>
15 int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
16 unsigned long end, int advice, unsigned long *vm_flags);
17 int __ksm_enter(struct mm_struct *mm);
18 void __ksm_exit(struct mm_struct *mm);
20 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
22 if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
23 return __ksm_enter(mm);
27 static inline void ksm_exit(struct mm_struct *mm)
29 if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
32 #else /* !CONFIG_KSM */
34 static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
35 unsigned long end, int advice, unsigned long *vm_flags)
40 static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
45 static inline void ksm_exit(struct mm_struct *mm)
48 #endif /* !CONFIG_KSM */