You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.1 KiB
51 lines
1.1 KiB
16 years ago
|
#ifndef __LINUX_KSM_H
|
||
|
#define __LINUX_KSM_H
|
||
|
/*
|
||
|
* Memory merging support.
|
||
|
*
|
||
|
* This code enables dynamic sharing of identical pages found in different
|
||
|
* memory areas, even if they are not shared by fork().
|
||
|
*/
|
||
|
|
||
|
#include <linux/bitops.h>
|
||
|
#include <linux/mm.h>
|
||
|
#include <linux/sched.h>
|
||
|
|
||
|
#ifdef CONFIG_KSM
|
||
|
int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
|
||
|
unsigned long end, int advice, unsigned long *vm_flags);
|
||
|
int __ksm_enter(struct mm_struct *mm);
|
||
|
void __ksm_exit(struct mm_struct *mm);
|
||
|
|
||
|
static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
|
||
|
{
|
||
|
if (test_bit(MMF_VM_MERGEABLE, &oldmm->flags))
|
||
|
return __ksm_enter(mm);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static inline void ksm_exit(struct mm_struct *mm)
|
||
|
{
|
||
|
if (test_bit(MMF_VM_MERGEABLE, &mm->flags))
|
||
|
__ksm_exit(mm);
|
||
|
}
|
||
|
#else /* !CONFIG_KSM */
|
||
|
|
||
|
static inline int ksm_madvise(struct vm_area_struct *vma, unsigned long start,
|
||
|
unsigned long end, int advice, unsigned long *vm_flags)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static inline int ksm_fork(struct mm_struct *mm, struct mm_struct *oldmm)
|
||
|
{
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
static inline void ksm_exit(struct mm_struct *mm)
|
||
|
{
|
||
|
}
|
||
|
#endif /* !CONFIG_KSM */
|
||
|
|
||
|
#endif
|