Skip to content

Commit c7b95d5

Browse files
author
Dominik Brodowski
committed
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>
1 parent a90f590 commit c7b95d5

8 files changed

Lines changed: 13 additions & 7 deletions

File tree

‎arch/mips/kernel/linux32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ SYSCALL_DEFINE1(32_personality, unsigned long, personality)
131131
asmlinkage ssize_t sys32_readahead(int fd, u32 pad0, u64 a2, u64 a3,
132132
size_t count)
133133
{
134-
return sys_readahead(fd, merge_64(a2, a3), count);
134+
return ksys_readahead(fd, merge_64(a2, a3), count);
135135
}
136136

137137
asmlinkage long sys32_sync_file_range(int fd, int __pad,

‎arch/parisc/kernel/sys_parisc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ asmlinkage ssize_t parisc_pwrite64(unsigned int fd, const char __user *buf,
345345
asmlinkage ssize_t parisc_readahead(int fd, unsigned int high, unsigned int low,
346346
size_t count)
347347
{
348-
return sys_readahead(fd, (loff_t)high << 32 | low, count);
348+
return ksys_readahead(fd, (loff_t)high << 32 | low, count);
349349
}
350350

351351
asmlinkage long parisc_fadvise64_64(int fd,

‎arch/powerpc/kernel/sys_ppc32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ compat_ssize_t compat_sys_pwrite64(unsigned int fd, const char __user *ubuf, com
8888

8989
compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count)
9090
{
91-
return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);
91+
return ksys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);
9292
}
9393

9494
asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4,

‎arch/s390/kernel/compat_linux.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ COMPAT_SYSCALL_DEFINE5(s390_pwrite64, unsigned int, fd, const char __user *, ubu
328328

329329
COMPAT_SYSCALL_DEFINE4(s390_readahead, int, fd, u32, high, u32, low, s32, count)
330330
{
331-
return sys_readahead(fd, (unsigned long)high << 32 | low, count);
331+
return ksys_readahead(fd, (unsigned long)high << 32 | low, count);
332332
}
333333

334334
struct stat64_emu31 {

‎arch/sparc/kernel/sys_sparc32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ asmlinkage long compat_sys_readahead(int fd,
217217
unsigned long offlo,
218218
compat_size_t count)
219219
{
220-
return sys_readahead(fd, (offhi << 32) | offlo, count);
220+
return ksys_readahead(fd, (offhi << 32) | offlo, count);
221221
}
222222

223223
long compat_sys_fadvise64(int fd,

‎arch/x86/ia32/sys_ia32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ COMPAT_SYSCALL_DEFINE6(x86_fadvise64_64, int, fd, __u32, offset_low,
203203
COMPAT_SYSCALL_DEFINE4(x86_readahead, int, fd, unsigned int, off_lo,
204204
unsigned int, off_hi, size_t, count)
205205
{
206-
return sys_readahead(fd, ((u64)off_hi << 32) | off_lo, count);
206+
return ksys_readahead(fd, ((u64)off_hi << 32) | off_lo, count);
207207
}
208208

209209
COMPAT_SYSCALL_DEFINE6(x86_sync_file_range, int, fd, unsigned int, off_low,

‎include/linux/syscalls.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -982,6 +982,7 @@ static inline int ksys_fadvise64_64(int fd, loff_t offset, loff_t len,
982982
unsigned long ksys_mmap_pgoff(unsigned long addr, unsigned long len,
983983
unsigned long prot, unsigned long flags,
984984
unsigned long fd, unsigned long pgoff);
985+
ssize_t ksys_readahead(int fd, loff_t offset, size_t count);
985986

986987
/*
987988
* The following kernel syscall equivalents are just wrappers to fs-internal

‎mm/readahead.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ do_readahead(struct address_space *mapping, struct file *filp,
573573
return force_page_cache_readahead(mapping, filp, index, nr);
574574
}
575575

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)
577577
{
578578
ssize_t ret;
579579
struct fd f;
@@ -592,3 +592,8 @@ SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
592592
}
593593
return ret;
594594
}
595+
596+
SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
597+
{
598+
return ksys_readahead(fd, offset, count);
599+
}

0 commit comments

Comments
 (0)