aboutsummaryrefslogtreecommitdiffstats
path: root/mm/huge_memory.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:46:55 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:42 -0500
commit0af4e98b6b095c74588af04872f83d333c958c32 (patch)
tree56b1965482470219a8cf11b7e7c875ae91bff46e /mm/huge_memory.c
parentf66055ab6fb9731dbfce320c5202ef4441b5d77f (diff)
thp: madvise(MADV_HUGEPAGE)
Add madvise MADV_HUGEPAGE to mark regions that are important to be hugepage backed. Return -EINVAL if the vma is not of an anonymous type, or the feature isn't built into the kernel. Never silently return success. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/huge_memory.c')
-rw-r--r--mm/huge_memory.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 763507932898..620891f4e54f 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -896,6 +896,22 @@ out:
896 return ret; 896 return ret;
897} 897}
898 898
899int hugepage_madvise(unsigned long *vm_flags)
900{
901 /*
902 * Be somewhat over-protective like KSM for now!
903 */
904 if (*vm_flags & (VM_HUGEPAGE | VM_SHARED | VM_MAYSHARE |
905 VM_PFNMAP | VM_IO | VM_DONTEXPAND |
906 VM_RESERVED | VM_HUGETLB | VM_INSERTPAGE |
907 VM_MIXEDMAP | VM_SAO))
908 return -EINVAL;
909
910 *vm_flags |= VM_HUGEPAGE;
911
912 return 0;
913}
914
899void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd) 915void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd)
900{ 916{
901 struct page *page; 917 struct page *page;