]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: mlock: add new mlock system call
authorEric B Munson <emunson@akamai.com>
Wed, 21 Oct 2015 22:03:24 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:24 +0000 (09:03 +1100)
With the refactored mlock code, introduce a new system call for mlock.
The new call will allow the user to specify what lock states are being
added.  mlock2 is trivial at the moment, but a follow on patch will add a
new mlock state making it useful.

Signed-off-by: Eric B Munson <emunson@akamai.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/entry/syscalls/syscall_32.tbl
arch/x86/entry/syscalls/syscall_64.tbl
include/linux/syscalls.h
include/uapi/asm-generic/unistd.h
kernel/sys_ni.c
mm/mlock.c

index 7663c455b9f650f67292e5a2c4664606fb1dbacb..143ef9f37932691c7af983924a7213e9a7824301 100644 (file)
 373    i386    shutdown                sys_shutdown
 374    i386    userfaultfd             sys_userfaultfd
 375    i386    membarrier              sys_membarrier
+376    i386    mlock2                  sys_mlock2
index 278842fdf1f6393d58ea0ac09abe60ef09e8ce79..314a90bfc09c16ab76c5d1451d7d2a4026be946f 100644 (file)
 322    64      execveat                stub_execveat
 323    common  userfaultfd             sys_userfaultfd
 324    common  membarrier              sys_membarrier
+325    common  mlock2                  sys_mlock2
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
index a460e2ef28437237d2b4bc2d09486b794290f21d..a156b82dd14cbad0b6f2867d07fc883fbc685c1e 100644 (file)
@@ -887,4 +887,6 @@ asmlinkage long sys_execveat(int dfd, const char __user *filename,
 
 asmlinkage long sys_membarrier(int cmd, int flags);
 
+asmlinkage long sys_mlock2(unsigned long start, size_t len, int flags);
+
 #endif
index ee124009e12adb073ec17221bc570da60cf5eaea..1324b0292ec28ed7ed61f1dc875d1fd84503a6d1 100644 (file)
@@ -713,9 +713,11 @@ __SC_COMP(__NR_execveat, sys_execveat, compat_sys_execveat)
 __SYSCALL(__NR_userfaultfd, sys_userfaultfd)
 #define __NR_membarrier 283
 __SYSCALL(__NR_membarrier, sys_membarrier)
+#define __NR_mlock2 284
+__SYSCALL(__NR_mlock2, sys_mlock2)
 
 #undef __NR_syscalls
-#define __NR_syscalls 284
+#define __NR_syscalls 285
 
 /*
  * All syscalls below here should go away really,
index a02decf155832fa03117ce6e6ebf89e6a0b2809f..0623787ec67af5fb95f505b55c1577a2f56ce0f4 100644 (file)
@@ -194,6 +194,7 @@ cond_syscall(sys_mlock);
 cond_syscall(sys_munlock);
 cond_syscall(sys_mlockall);
 cond_syscall(sys_munlockall);
+cond_syscall(sys_mlock2);
 cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
index fbd8c03f7b37985542977575fabca53b54355a1d..35dcf8fa7195f4803314122e01a2f3e3f03bc316 100644 (file)
@@ -644,6 +644,14 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
        return do_mlock(start, len, VM_LOCKED);
 }
 
+SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags)
+{
+       if (flags)
+               return -EINVAL;
+
+       return do_mlock(start, len, VM_LOCKED);
+}
+
 SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
 {
        int ret;