diff options
author | Alex Thorlton <athorlton@sgi.com> | 2014-04-07 18:37:10 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 19:35:52 -0400 |
commit | a0715cc22601e8830ace98366c0c2bd8da52af52 (patch) | |
tree | 4444c61a4685d10d683e1f29177a9e7cfbccae73 /kernel/sys.c | |
parent | 1e1836e84f87d12feac6dd225fcef5eba1ca724b (diff) |
mm, thp: add VM_INIT_DEF_MASK and PRCTL_THP_DISABLE
Add VM_INIT_DEF_MASK, to allow us to set the default flags for VMs. It
also adds a prctl control which allows us to set the THP disable bit in
mm->def_flags so that VMs will pick up the setting as they are created.
Signed-off-by: Alex Thorlton <athorlton@sgi.com>
Suggested-by: Oleg Nesterov <oleg@redhat.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index adaeab6f7a87..fba0f29401ea 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1996,6 +1996,21 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
1996 | if (arg2 || arg3 || arg4 || arg5) | 1996 | if (arg2 || arg3 || arg4 || arg5) |
1997 | return -EINVAL; | 1997 | return -EINVAL; |
1998 | return current->no_new_privs ? 1 : 0; | 1998 | return current->no_new_privs ? 1 : 0; |
1999 | case PR_GET_THP_DISABLE: | ||
2000 | if (arg2 || arg3 || arg4 || arg5) | ||
2001 | return -EINVAL; | ||
2002 | error = !!(me->mm->def_flags & VM_NOHUGEPAGE); | ||
2003 | break; | ||
2004 | case PR_SET_THP_DISABLE: | ||
2005 | if (arg3 || arg4 || arg5) | ||
2006 | return -EINVAL; | ||
2007 | down_write(&me->mm->mmap_sem); | ||
2008 | if (arg2) | ||
2009 | me->mm->def_flags |= VM_NOHUGEPAGE; | ||
2010 | else | ||
2011 | me->mm->def_flags &= ~VM_NOHUGEPAGE; | ||
2012 | up_write(&me->mm->mmap_sem); | ||
2013 | break; | ||
1999 | default: | 2014 | default: |
2000 | error = -EINVAL; | 2015 | error = -EINVAL; |
2001 | break; | 2016 | break; |