Re: [PATCH V3 2/5] mm: mlock: Add new mlock, munlock, and munlockall system calls
On Tue, Jul 07, 2015 at 01:03:40PM -0400, Eric B Munson wrote: diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 05745eb..514e77b 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S @@ -397,6 +397,9 @@ /* 385 */CALL(sys_memfd_create) CALL(sys_bpf) CALL(sys_execveat) + CALL(sys_mlock2) + CALL(sys_munlock2) +/* 400 */CALL(sys_munlockall2) s/400/390/ diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h index cef934a..318072aa 100644 --- a/arch/arm64/include/asm/unistd32.h +++ b/arch/arm64/include/asm/unistd32.h @@ -797,3 +797,9 @@ __SYSCALL(__NR_memfd_create, sys_memfd_create) __SYSCALL(__NR_bpf, sys_bpf) #define __NR_execveat 387 __SYSCALL(__NR_execveat, compat_sys_execveat) +#define __NR_mlock2 388 +__SYSCALL(__NR_mlock2, sys_mlock2) +#define __NR_munlock2 389 +__SYSCALL(__NR_munlock2, sys_munlock2) +#define __NR_munlockall2 390 +__SYSCALL(__NR_munlockall2, sys_munlockall2) These look fine. Catalin ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 2/5] mm: mlock: Add new mlock, munlock, and munlockall system calls
On Wed, Jul 8, 2015 at 8:46 AM, Heiko Carstens heiko.carst...@de.ibm.com wrote: diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 1acad02..f6d81d6 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S @@ -363,3 +363,6 @@ SYSCALL(sys_bpf,compat_sys_bpf) SYSCALL(sys_s390_pci_mmio_write,compat_sys_s390_pci_mmio_write) SYSCALL(sys_s390_pci_mmio_read,compat_sys_s390_pci_mmio_read) SYSCALL(sys_execveat,compat_sys_execveat) +SYSCALL(sys_mlock2,compat_sys_mlock2)/* 355 */ +SYSCALL(sys_munlock2,compat_sys_munlock2) +SYSCALL(sys_munlockall2,compat_sys_munlockall2) FWIW, you would also need to add matching lines to the two files arch/s390/include/uapi/asm/unistd.h arch/s390/kernel/compat_wrapper.c so that the system call would be wired up on s390. Similar comment for m68k: arch/m68k/include/asm/unistd.h arch/m68k/include/uapi/asm/unistd.h I think you best look at the last commits that added system calls, for all architectures, to make sure you don't do partial updates. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say programmer or something like that. -- Linus Torvalds ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
Re: [PATCH V3 2/5] mm: mlock: Add new mlock, munlock, and munlockall system calls
On Tue, Jul 07, 2015 at 01:03:40PM -0400, Eric B Munson wrote: With the refactored mlock code, introduce new system calls for mlock, munlock, and munlockall. The new calls will allow the user to specify what lock states are being added or cleared. mlock2 and munlock2 are trivial at the moment, but a follow on patch will add a new mlock state making them useful. munlock2 addresses a limitation of the current implementation. If a user calls mlockall(MCL_CURRENT | MCL_FUTURE) and then later decides that MCL_FUTURE should be removed, they would have to call munlockall() followed by mlockall(MCL_CURRENT) which could potentially be very expensive. The new munlockall2 system call allows a user to simply clear the MCL_FUTURE flag. Signed-off-by: Eric B Munson emun...@akamai.com ... diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 1acad02..f6d81d6 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S @@ -363,3 +363,6 @@ SYSCALL(sys_bpf,compat_sys_bpf) SYSCALL(sys_s390_pci_mmio_write,compat_sys_s390_pci_mmio_write) SYSCALL(sys_s390_pci_mmio_read,compat_sys_s390_pci_mmio_read) SYSCALL(sys_execveat,compat_sys_execveat) +SYSCALL(sys_mlock2,compat_sys_mlock2)/* 355 */ +SYSCALL(sys_munlock2,compat_sys_munlock2) +SYSCALL(sys_munlockall2,compat_sys_munlockall2) FWIW, you would also need to add matching lines to the two files arch/s390/include/uapi/asm/unistd.h arch/s390/kernel/compat_wrapper.c so that the system call would be wired up on s390. ___ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev
[PATCH V3 2/5] mm: mlock: Add new mlock, munlock, and munlockall system calls
With the refactored mlock code, introduce new system calls for mlock, munlock, and munlockall. The new calls will allow the user to specify what lock states are being added or cleared. mlock2 and munlock2 are trivial at the moment, but a follow on patch will add a new mlock state making them useful. munlock2 addresses a limitation of the current implementation. If a user calls mlockall(MCL_CURRENT | MCL_FUTURE) and then later decides that MCL_FUTURE should be removed, they would have to call munlockall() followed by mlockall(MCL_CURRENT) which could potentially be very expensive. The new munlockall2 system call allows a user to simply clear the MCL_FUTURE flag. Signed-off-by: Eric B Munson emun...@akamai.com Cc: Michal Hocko mho...@suse.cz Cc: Vlastimil Babka vba...@suse.cz Cc: linux-al...@vger.kernel.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: adi-buildroot-de...@lists.sourceforge.net Cc: linux-cris-ker...@axis.com Cc: linux-i...@vger.kernel.org Cc: linux-m...@lists.linux-m68k.org Cc: linux-m...@linux-mips.org Cc: linux-am33-l...@redhat.com Cc: linux-par...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-s...@vger.kernel.org Cc: linux...@vger.kernel.org Cc: sparcli...@vger.kernel.org Cc: linux-xte...@linux-xtensa.org Cc: linux-...@vger.kernel.org Cc: linux-a...@vger.kernel.org Cc: linux...@kvack.org --- arch/alpha/include/asm/unistd.h| 2 +- arch/alpha/include/uapi/asm/mman.h | 2 ++ arch/alpha/kernel/systbls.S| 3 +++ arch/arm/kernel/calls.S| 3 +++ arch/arm64/include/asm/unistd32.h | 6 ++ arch/avr32/kernel/syscall_table.S | 3 +++ arch/blackfin/mach-common/entry.S | 3 +++ arch/cris/arch-v10/kernel/entry.S | 3 +++ arch/cris/arch-v32/kernel/entry.S | 3 +++ arch/frv/kernel/entry.S| 3 +++ arch/ia64/kernel/entry.S | 3 +++ arch/m32r/kernel/entry.S | 3 +++ arch/m32r/kernel/syscall_table.S | 3 +++ arch/m68k/kernel/syscalltable.S| 3 +++ arch/microblaze/kernel/syscall_table.S | 3 +++ arch/mips/include/uapi/asm/mman.h | 5 + arch/mips/kernel/scall32-o32.S | 3 +++ arch/mips/kernel/scall64-64.S | 3 +++ arch/mips/kernel/scall64-n32.S | 3 +++ arch/mips/kernel/scall64-o32.S | 3 +++ arch/mn10300/kernel/entry.S| 3 +++ arch/parisc/include/uapi/asm/mman.h| 2 ++ arch/powerpc/include/uapi/asm/mman.h | 2 ++ arch/s390/kernel/syscalls.S| 3 +++ arch/sh/kernel/syscalls_32.S | 3 +++ arch/sparc/include/uapi/asm/mman.h | 2 ++ arch/sparc/kernel/systbls_32.S | 2 +- arch/sparc/kernel/systbls_64.S | 4 ++-- arch/tile/include/uapi/asm/mman.h | 5 + arch/x86/entry/syscalls/syscall_32.tbl | 3 +++ arch/x86/entry/syscalls/syscall_64.tbl | 3 +++ arch/xtensa/include/uapi/asm/mman.h| 5 + arch/xtensa/include/uapi/asm/unistd.h | 10 -- include/linux/syscalls.h | 4 include/uapi/asm-generic/mman.h| 2 ++ include/uapi/asm-generic/unistd.h | 8 +++- kernel/sys_ni.c| 3 +++ mm/mlock.c | 28 38 files changed, 148 insertions(+), 7 deletions(-) diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index a56e608..1d09392 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h @@ -3,7 +3,7 @@ #include uapi/asm/unistd.h -#define NR_SYSCALLS514 +#define NR_SYSCALLS517 #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_STAT64 diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h index 0086b47..ec72436 100644 --- a/arch/alpha/include/uapi/asm/mman.h +++ b/arch/alpha/include/uapi/asm/mman.h @@ -38,6 +38,8 @@ #define MCL_CURRENT 8192 /* lock all currently mapped pages */ #define MCL_FUTURE 16384 /* lock all additions to address space */ +#define MLOCK_LOCKED 0x01/* Lock and populate the specified range */ + #define MADV_NORMAL0 /* no further special treatment */ #define MADV_RANDOM1 /* expect random page references */ #define MADV_SEQUENTIAL2 /* expect sequential page references */ diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 9b62e3f..04d1cce 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S @@ -532,6 +532,9 @@ sys_call_table: .quad sys_getrandom .quad sys_memfd_create .quad sys_execveat + .quad sys_mlock2 + .quad sys_munlock2 /* 515 */ + .quad sys_munlockall2 .size sys_call_table, . - sys_call_table .type sys_call_table, @object diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index