diff options
| author | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-03-19 12:51:36 -0400 |
|---|---|---|
| committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-04-02 14:16:12 -0400 |
| commit | c7b95d5156a9ee70f800bd2e47a9eba677be73e1 (patch) | |
| tree | a6f4b1d0d4bc5f9be4665034f8cadcce6ac472c5 | |
| parent | a90f590a1bee36fc2129cfb38ceec24a555bb12d (diff) | |
mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead()
Using this helper allows us to avoid the in-kernel calls to the
sys_readahead() syscall. The ksys_ prefix denotes that this function is
meant as a drop-in replacement for the syscall. In particular, it uses the
same calling convention as sys_readahead().
This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| -rw-r--r-- | arch/mips/kernel/linux32.c | 2 | ||||
| -rw-r--r-- | arch/parisc/kernel/sys_parisc.c | 2 | ||||
| -rw-r--r-- | arch/powerpc/kernel/sys_ppc32.c | 2 | ||||
| -rw-r--r-- | arch/s390/kernel/compat_linux.c | 2 | ||||
| -rw-r--r-- | arch/sparc/kernel/sys_sparc32.c | 2 | ||||
| -rw-r--r-- | arch/x86/ia32/sys_ia32.c | 2 | ||||
| -rw-r--r-- | include/linux/syscalls.h | 1 | ||||
| -rw-r--r-- | mm/readahead.c | 7 |
8 files changed, 13 insertions, 7 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 0571ab7b68b0..318f1c05c5b3 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c | |||
| @@ -131,7 +131,7 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality) | |||
| 131 | asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, | 131 | asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3, |
| 132 | size_t count) | 132 | size_t count) |
| 133 | { | 133 | { |
| 134 | return sys_readahead(fd, merge_64(a2, a3), count); | 134 | return ksys_readahead(fd, merge_64(a2, a3), count); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | asmlinkage long sys32_sync_file_range(int fd, int __pad, | 137 | asmlinkage long sys32_sync_file_range(int fd, int __pad, |
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c index 080d566654ea..8c99ebbe2bac 100644 --- a/arch/parisc/kernel/sys_parisc.c +++ b/arch/parisc/kernel/sys_parisc.c | |||
| @@ -345,7 +345,7 @@ asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf, | |||
| 345 | asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low, | 345 | asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low, |
| 346 | size_t count) | 346 | size_t count) |
| 347 | { | 347 | { |
| 348 | return sys_readahead(fd, (loff_t)high << 32 | low, count); | 348 | return ksys_readahead(fd, (loff_t)high << 32 | low, count); |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | asmlinkage long parisc_fadvise64_64(int fd, | 351 | asmlinkage long parisc_fadvise64_64(int fd, |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 0b95fa13307f..c11c73373691 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
| @@ -88,7 +88,7 @@ compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, com | |||
| 88 | 88 | ||
| 89 | compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) | 89 | compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count) |
| 90 | { | 90 | { |
| 91 | return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); | 91 | return ksys_readahead(fd, ((loff_t)offhi << 32) | offlo, count); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, | 94 | asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index da5ef7718254..8ac38d51ed7d 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
| @@ -328,7 +328,7 @@ COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubu | |||
| 328 | 328 | ||
| 329 | COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count) | 329 | COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count) |
| 330 | { | 330 | { |
| 331 | return sys_readahead(fd, (unsigned long)high << 32 | low, count); | 331 | return ksys_readahead(fd, (unsigned long)high << 32 | low, count); |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | struct stat64_emu31 { | 334 | struct stat64_emu31 { |
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c index 4da66aed50b4..f166e5bbf506 100644 --- a/arch/sparc/kernel/sys_sparc32.c +++ b/arch/sparc/kernel/sys_sparc32.c | |||
| @@ -217,7 +217,7 @@ asmlinkage long compat_sys_readahead(int fd, | |||
| 217 | unsigned long offlo, | 217 | unsigned long offlo, |
| 218 | compat_size_t count) | 218 | compat_size_t count) |
| 219 | { | 219 | { |
| 220 | return sys_readahead(fd, (offhi << 32) | offlo, count); | 220 | return ksys_readahead(fd, (offhi << 32) | offlo, count); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | long compat_sys_fadvise64(int fd, | 223 | long compat_sys_fadvise64(int fd, |
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c index bff71b9ae3f5..bd8a7020b9a7 100644 --- a/arch/x86/ia32/sys_ia32.c +++ b/arch/x86/ia32/sys_ia32.c | |||
| @@ -203,7 +203,7 @@ COMPAT_SYSCALL_DEFINE6(x86_fadvise64_64, int, fd, __u32, offset_low, | |||
| 203 | COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo, | 203 | COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo, |
| 204 | unsigned int, off_hi, size_t, count) | 204 | unsigned int, off_hi, size_t, count) |
| 205 | { | 205 | { |
| 206 | return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count); | 206 | return ksys_readahead(fd, ((u64)off_hi << 32) | off_lo, count); |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low, | 209 | COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low, |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index ec866c959e7d..815fbdd9cca1 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -982,6 +982,7 @@ static inline int ksys_fadvise64_64(int fd, loff_t offset, loff_t len, | |||
| 982 | unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, | 982 | unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len, |
| 983 | unsigned long prot, unsigned long flags, | 983 | unsigned long prot, unsigned long flags, |
| 984 | unsigned long fd, unsigned long pgoff); | 984 | unsigned long fd, unsigned long pgoff); |
| 985 | ssize_t ksys_readahead(int fd, loff_t offset, size_t count); | ||
| 985 | 986 | ||
| 986 | /* | 987 | /* |
| 987 | * The following kernel syscall equivalents are just wrappers to fs-internal | 988 | * The following kernel syscall equivalents are just wrappers to fs-internal |
diff --git a/mm/readahead.c b/mm/readahead.c index c4ca70239233..4d57b4644f98 100644 --- a/mm/readahead.c +++ b/mm/readahead.c | |||
| @@ -573,7 +573,7 @@ do_readahead(struct address_space *mapping, struct file *filp, | |||
| 573 | return force_page_cache_readahead(mapping, filp, index, nr); | 573 | return force_page_cache_readahead(mapping, filp, index, nr); |
| 574 | } | 574 | } |
| 575 | 575 | ||
| 576 | SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count) | 576 | ssize_t ksys_readahead(int fd, loff_t offset, size_t count) |
| 577 | { | 577 | { |
| 578 | ssize_t ret; | 578 | ssize_t ret; |
| 579 | struct fd f; | 579 | struct fd f; |
| @@ -592,3 +592,8 @@ SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count) | |||
| 592 | } | 592 | } |
| 593 | return ret; | 593 | return ret; |
| 594 | } | 594 | } |
| 595 | |||
| 596 | SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count) | ||
| 597 | { | ||
| 598 | return ksys_readahead(fd, offset, count); | ||
| 599 | } | ||
