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>
这个提交包含在:
Andrea Arcangeli
2011-01-13 15:46:55 -08:00
提交者 Linus Torvalds
父节点 f66055ab6f
当前提交 0af4e98b6b
修改 3 个文件,包含 30 行新增0 行删除

查看文件

@@ -71,6 +71,11 @@ static long madvise_behavior(struct vm_area_struct * vma,
if (error)
goto out;
break;
case MADV_HUGEPAGE:
error = hugepage_madvise(&new_flags);
if (error)
goto out;
break;
}
if (new_flags == vma->vm_flags) {
@@ -282,6 +287,9 @@ madvise_behavior_valid(int behavior)
#ifdef CONFIG_KSM
case MADV_MERGEABLE:
case MADV_UNMERGEABLE:
#endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
case MADV_HUGEPAGE:
#endif
return 1;