-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Andrea Arcangeli
authored and
Linus Torvalds
committed
Jan 14, 2011
1 parent
3175152
commit cde8c3d
Showing
6 changed files
with
1,137 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 79134171df238171daa4c024a42b77b401ccb00b | ||
refs/heads/master: ba76149f47d8c939efa0acc07a191237af900471 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#ifndef _LINUX_KHUGEPAGED_H | ||
#define _LINUX_KHUGEPAGED_H | ||
|
||
#include <linux/sched.h> /* MMF_VM_HUGEPAGE */ | ||
|
||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE | ||
extern int __khugepaged_enter(struct mm_struct *mm); | ||
extern void __khugepaged_exit(struct mm_struct *mm); | ||
extern int khugepaged_enter_vma_merge(struct vm_area_struct *vma); | ||
|
||
#define khugepaged_enabled() \ | ||
(transparent_hugepage_flags & \ | ||
((1<<TRANSPARENT_HUGEPAGE_FLAG) | \ | ||
(1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG))) | ||
#define khugepaged_always() \ | ||
(transparent_hugepage_flags & \ | ||
(1<<TRANSPARENT_HUGEPAGE_FLAG)) | ||
#define khugepaged_req_madv() \ | ||
(transparent_hugepage_flags & \ | ||
(1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)) | ||
#define khugepaged_defrag() \ | ||
(transparent_hugepage_flags & \ | ||
(1<<TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG)) | ||
|
||
static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) | ||
{ | ||
if (test_bit(MMF_VM_HUGEPAGE, &oldmm->flags)) | ||
return __khugepaged_enter(mm); | ||
return 0; | ||
} | ||
|
||
static inline void khugepaged_exit(struct mm_struct *mm) | ||
{ | ||
if (test_bit(MMF_VM_HUGEPAGE, &mm->flags)) | ||
__khugepaged_exit(mm); | ||
} | ||
|
||
static inline int khugepaged_enter(struct vm_area_struct *vma) | ||
{ | ||
if (!test_bit(MMF_VM_HUGEPAGE, &vma->vm_mm->flags)) | ||
if (khugepaged_always() || | ||
(khugepaged_req_madv() && | ||
vma->vm_flags & VM_HUGEPAGE)) | ||
if (__khugepaged_enter(vma->vm_mm)) | ||
return -ENOMEM; | ||
return 0; | ||
} | ||
#else /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
static inline int khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) | ||
{ | ||
return 0; | ||
} | ||
static inline void khugepaged_exit(struct mm_struct *mm) | ||
{ | ||
} | ||
static inline int khugepaged_enter(struct vm_area_struct *vma) | ||
{ | ||
return 0; | ||
} | ||
static inline int khugepaged_enter_vma_merge(struct vm_area_struct *vma) | ||
{ | ||
return 0; | ||
} | ||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ | ||
|
||
#endif /* _LINUX_KHUGEPAGED_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.