* [PATCH 3/6] fs/splice: support compiling out splice-family syscalls [not found] ` <1416690001-20817-1-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> @ 2014-11-22 20:59 ` Pieter Smith [not found] ` <1416690001-20817-4-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Pieter Smith @ 2014-11-22 20:59 UTC (permalink / raw) To: pieter-qeJ+1H9vRZbz+pZb47iToQ Cc: Josh Triplett, Alexander Viro, Andrew Morton, Paul E. McKenney, Matt Turner, Michal Hocko, Geert Uytterhoeven, 蔡正龙, Paul Gortmaker, Bertrand Jacquin, Luis R. Rodriguez, Fabian Frederick, Peter Foley, Eric W. Biederman, Mel Gorman, Oleg Nesterov, Alexei Starovoitov, Iulia Manda, Kees Cook, Catalina Mocanu, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, ope Many embedded systems will not need the splice-family syscalls (splice, vmsplice, tee and sendfile). Omitting them saves space. This adds a new EXPERT config option CONFIG_SYSCALL_SPLICE (default y) to support compiling them out. This patch removes almost all callers of .splice_read() and .splice_write() in the file_operations struct. This paves the way to eventually compile out the .splice_read and .splice_write members of the file_operations struct as well as the remaining splice-related infrastructure. add/remove: 0/16 grow/shrink: 2/5 up/down: 114/-3693 (-3579) function old new delta splice_direct_to_actor 348 416 +68 splice_to_pipe 371 417 +46 splice_from_pipe_next 107 106 -1 fdput 11 - -11 signal_pending 39 26 -13 fdget 56 42 -14 user_page_pipe_buf_ops 20 - -20 user_page_pipe_buf_steal 25 - -25 file_end_write 58 29 -29 file_start_write 68 34 -34 pipe_to_user 43 - -43 wakeup_pipe_readers 54 - -54 do_splice_to 87 - -87 ipipe_prep.part 92 - -92 opipe_prep.part 119 - -119 sys_sendfile 122 - -122 sys_sendfile64 126 - -126 sys_vmsplice 137 - -137 vmsplice_to_user 205 - -205 sys_tee 491 - -491 do_sendfile 492 - -492 vmsplice_to_pipe 558 - -558 sys_splice 1020 - -1020 Signed-off-by: Pieter Smith <pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> --- fs/splice.c | 2 ++ init/Kconfig | 10 ++++++++++ kernel/sys_ni.c | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index 44b201b..7c4c695 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1316,6 +1316,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, return ret; } +#ifdef CONFIG_SYSCALL_SPLICE static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, struct pipe_inode_info *opipe, size_t len, unsigned int flags); @@ -2200,4 +2201,5 @@ COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, return do_sendfile(out_fd, in_fd, NULL, count, 0); } #endif +#endif diff --git a/init/Kconfig b/init/Kconfig index d811d5f..dec9819 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1571,6 +1571,16 @@ config NTP system clock to an NTP server, you can disable this option to save space. +config SYSCALL_SPLICE + bool "Enable splice/vmsplice/tee/sendfile syscalls" if EXPERT + default y + help + This option enables the splice, vmsplice, tee and sendfile syscalls. These + are used by applications to: move data between buffers and arbitrary file + descriptors; "copy" data between buffers; or copy data from userspace into + buffers. If building an embedded system where no applications use these + syscalls, you can disable this option to save space. + config PCI_QUIRKS default y bool "Enable PCI quirk workarounds" if EXPERT diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index d2f5b00..25d5551 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -170,6 +170,14 @@ cond_syscall(sys_fstat); cond_syscall(sys_stat); cond_syscall(sys_uname); cond_syscall(sys_olduname); +cond_syscall(sys_vmsplice); +cond_syscall(sys_splice); +cond_syscall(sys_tee); +cond_syscall(sys_sendfile); +cond_syscall(sys_sendfile64); +cond_syscall(compat_sys_vmsplice); +cond_syscall(compat_sys_sendfile); +cond_syscall(compat_sys_sendfile64); /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read); -- 1.9.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1416690001-20817-4-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org>]
* Re: [PATCH 3/6] fs/splice: support compiling out splice-family syscalls [not found] ` <1416690001-20817-4-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> @ 2014-11-22 21:50 ` Josh Triplett 0 siblings, 0 replies; 3+ messages in thread From: Josh Triplett @ 2014-11-22 21:50 UTC (permalink / raw) To: Pieter Smith Cc: Alexander Viro, Andrew Morton, Paul E. McKenney, Matt Turner, Michal Hocko, Geert Uytterhoeven, 蔡正龙, Paul Gortmaker, Bertrand Jacquin, Luis R. Rodriguez, Fabian Frederick, Peter Foley, Eric W. Biederman, Mel Gorman, Oleg Nesterov, Alexei Starovoitov, Iulia Manda, Kees Cook, Catalina Mocanu, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, open list, open list:ABI/API On Sat, Nov 22, 2014 at 09:59:58PM +0100, Pieter Smith wrote: > Many embedded systems will not need the splice-family syscalls (splice, > vmsplice, tee and sendfile). Omitting them saves space. This adds a new EXPERT > config option CONFIG_SYSCALL_SPLICE (default y) to support compiling them out. > > This patch removes almost all callers of .splice_read() and .splice_write() > in the file_operations struct. This paves the way to eventually compile out the > .splice_read and .splice_write members of the file_operations struct as well as > the remaining splice-related infrastructure. This commit message doesn't reflect the new approach of leaving those members in the structure. The patch looks good otherwise. - Josh Triplett > add/remove: 0/16 grow/shrink: 2/5 up/down: 114/-3693 (-3579) > function old new delta > splice_direct_to_actor 348 416 +68 > splice_to_pipe 371 417 +46 > splice_from_pipe_next 107 106 -1 > fdput 11 - -11 > signal_pending 39 26 -13 > fdget 56 42 -14 > user_page_pipe_buf_ops 20 - -20 > user_page_pipe_buf_steal 25 - -25 > file_end_write 58 29 -29 > file_start_write 68 34 -34 > pipe_to_user 43 - -43 > wakeup_pipe_readers 54 - -54 > do_splice_to 87 - -87 > ipipe_prep.part 92 - -92 > opipe_prep.part 119 - -119 > sys_sendfile 122 - -122 > sys_sendfile64 126 - -126 > sys_vmsplice 137 - -137 > vmsplice_to_user 205 - -205 > sys_tee 491 - -491 > do_sendfile 492 - -492 > vmsplice_to_pipe 558 - -558 > sys_splice 1020 - -1020 > > Signed-off-by: Pieter Smith <pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> > --- > fs/splice.c | 2 ++ > init/Kconfig | 10 ++++++++++ > kernel/sys_ni.c | 8 ++++++++ > 3 files changed, 20 insertions(+) > > diff --git a/fs/splice.c b/fs/splice.c > index 44b201b..7c4c695 100644 > --- a/fs/splice.c > +++ b/fs/splice.c > @@ -1316,6 +1316,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, > return ret; > } > > +#ifdef CONFIG_SYSCALL_SPLICE > static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, > struct pipe_inode_info *opipe, > size_t len, unsigned int flags); > @@ -2200,4 +2201,5 @@ COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, > return do_sendfile(out_fd, in_fd, NULL, count, 0); > } > #endif > +#endif > > diff --git a/init/Kconfig b/init/Kconfig > index d811d5f..dec9819 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -1571,6 +1571,16 @@ config NTP > system clock to an NTP server, you can disable this option to save > space. > > +config SYSCALL_SPLICE > + bool "Enable splice/vmsplice/tee/sendfile syscalls" if EXPERT > + default y > + help > + This option enables the splice, vmsplice, tee and sendfile syscalls. These > + are used by applications to: move data between buffers and arbitrary file > + descriptors; "copy" data between buffers; or copy data from userspace into > + buffers. If building an embedded system where no applications use these > + syscalls, you can disable this option to save space. > + > config PCI_QUIRKS > default y > bool "Enable PCI quirk workarounds" if EXPERT > diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c > index d2f5b00..25d5551 100644 > --- a/kernel/sys_ni.c > +++ b/kernel/sys_ni.c > @@ -170,6 +170,14 @@ cond_syscall(sys_fstat); > cond_syscall(sys_stat); > cond_syscall(sys_uname); > cond_syscall(sys_olduname); > +cond_syscall(sys_vmsplice); > +cond_syscall(sys_splice); > +cond_syscall(sys_tee); > +cond_syscall(sys_sendfile); > +cond_syscall(sys_sendfile64); > +cond_syscall(compat_sys_vmsplice); > +cond_syscall(compat_sys_sendfile); > +cond_syscall(compat_sys_sendfile64); > > /* arch-specific weak syscall entries */ > cond_syscall(sys_pciconfig_read); > -- > 1.9.1 > ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 0/6] kernel tinification: optionally compile out splice family of syscalls (splice, vmsplice, tee and sendfile) @ 2014-11-23 14:20 Pieter Smith 2014-11-23 14:20 ` [PATCH 3/6] fs/splice: support compiling out splice-family syscalls Pieter Smith 0 siblings, 1 reply; 3+ messages in thread From: Pieter Smith @ 2014-11-23 14:20 UTC (permalink / raw) To: pieter Cc: Josh Triplett, Alexander Duyck, Alexander Viro, Alexei Starovoitov, Andrew Morton, Bertrand Jacquin, Catalina Mocanu, Daniel Borkmann, David S. Miller, Eric Dumazet, Eric W. Biederman, Fabian Frederick, open list:FUSE: FILESYSTEM..., Geert Uytterhoeven, Hugh Dickins, Iulia Manda, Jan Beulich, J. Bruce Fields, Jeff Layton, open list:ABI/API, linux-fsdevel, linux-kernel REPO: https://github.com/smipi1/linux-tinification.git BRANCH: tiny/config-syscall-splice BACKGROUND: This patch-set forms part of the Linux Kernel Tinification effort ( https://tiny.wiki.kernel.org/). GOAL: Support compiling out the splice family of syscalls (splice, vmsplice, tee and sendfile) along with all supporting infrastructure if not needed. Many embedded systems will not need the splice-family syscalls. Omitting them saves space. STRATEGY: a. With the goal of eventually compiling out fs/splice.c, several functions that are only used in support of the the splice family of syscalls are moved into fs/splice.c from fs/read_write.c. The kernel_write function that is not used to support the splice syscalls is moved to fs/read_write.c: 0001-fs-move-sendfile-syscall-into-fs-splice.patch 0002-fs-moved-kernel_write-to-fs-read_write.patch b. Introduce an EXPERT kernel configuration option; CONFIG_SYSCALL_SPLICE; to compile out the splice family of syscalls. This removes all userspace uses of the splice infrastructure. 0003-fs-splice-support-compiling-out-splice-family-syscal.patch c. Splice exports an operations struct, nosteal_pipe_buf_ops. Eliminate the use of this struct when CONFIG_SYSCALL_SPLICE is undefined, so that splice can later be compiled out: 0004-fs-fuse-support-compiling-out-splice.patch 0005-net-core-support-compiling-out-splice.patch e. Compile out fs/splice.c. Functions exported by fs/splice are mocked out with failing static inlines. This is done so as to all but eliminate the maintenance burden on file-system drivers. 0006-fs-splice-full-support-for-compiling-out-splice.patch RESULTS: A tinyconfig bloat-o-meter score for the entire patch-set: add/remove: 0/41 grow/shrink: 5/7 up/down: 23/-8422 (-8399) function old new delta sys_pwritev 115 122 +7 sys_preadv 115 122 +7 fdput_pos 29 36 +7 sys_pwrite64 115 116 +1 sys_pread64 115 116 +1 pipe_to_null 4 - -4 generic_pipe_buf_nosteal 6 - -6 spd_release_page 10 - -10 fdput 11 - -11 PageUptodate 22 11 -11 lock_page 36 24 -12 signal_pending 39 26 -13 fdget 56 42 -14 page_cache_pipe_buf_release 16 - -16 user_page_pipe_buf_ops 20 - -20 splice_write_null 24 4 -20 page_cache_pipe_buf_ops 20 - -20 nosteal_pipe_buf_ops 20 - -20 default_pipe_buf_ops 20 - -20 generic_splice_sendpage 24 - -24 user_page_pipe_buf_steal 25 - -25 splice_shrink_spd 27 - -27 pipe_to_user 43 - -43 direct_splice_actor 47 - -47 default_file_splice_write 49 - -49 wakeup_pipe_writers 54 - -54 wakeup_pipe_readers 54 - -54 write_pipe_buf 71 - -71 page_cache_pipe_buf_confirm 80 - -80 splice_grow_spd 87 - -87 do_splice_to 87 - -87 ipipe_prep.part 92 - -92 splice_from_pipe 93 - -93 splice_from_pipe_next 107 - -107 pipe_to_sendpage 109 - -109 page_cache_pipe_buf_steal 114 - -114 opipe_prep.part 119 - -119 sys_sendfile 122 - -122 generic_file_splice_read 131 8 -123 sys_sendfile64 126 - -126 sys_vmsplice 137 - -137 do_splice_direct 148 - -148 vmsplice_to_user 205 - -205 __splice_from_pipe 246 - -246 splice_direct_to_actor 348 - -348 splice_to_pipe 371 - -371 do_sendfile 492 - -492 sys_tee 497 - -497 vmsplice_to_pipe 558 - -558 default_file_splice_read 688 - -688 iter_file_splice_write 702 4 -698 sys_splice 1075 - -1075 __generic_file_splice_read 1109 - -1109 Pieter Smith (6): fs: move sendfile syscall into fs/splice fs: moved kernel_write to fs/read_write fs/splice: support compiling out splice-family syscalls fs/fuse: support compiling out splice net/core: support compiling out splice fs/splice: full support for compiling out splice fs/Makefile | 3 +- fs/fuse/dev.c | 4 +- fs/read_write.c | 181 +++------------------------------------------ fs/splice.c | 194 +++++++++++++++++++++++++++++++++++++++++++++---- include/linux/fs.h | 32 ++++++++ include/linux/skbuff.h | 9 +++ include/linux/splice.h | 42 +++++++++++ init/Kconfig | 10 +++ kernel/sys_ni.c | 8 ++ net/core/skbuff.c | 9 ++- 10 files changed, 300 insertions(+), 192 deletions(-) -- 2.1.0 ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/6] fs/splice: support compiling out splice-family syscalls 2014-11-23 14:20 [PATCH 0/6] kernel tinification: optionally compile out splice family of syscalls (splice, vmsplice, tee and sendfile) Pieter Smith @ 2014-11-23 14:20 ` Pieter Smith 0 siblings, 0 replies; 3+ messages in thread From: Pieter Smith @ 2014-11-23 14:20 UTC (permalink / raw) To: pieter Cc: Josh Triplett, Alexander Duyck, Alexander Viro, Alexei Starovoitov, Andrew Morton, Bertrand Jacquin, Catalina Mocanu, Daniel Borkmann, David S. Miller, Eric Dumazet, Eric W. Biederman, Fabian Frederick, open list:FUSE: FILESYSTEM..., Geert Uytterhoeven, Hugh Dickins, Iulia Manda, Jan Beulich, J. Bruce Fields, Jeff Layton, open list:ABI/API, linux-fsdevel, linux-kernel Many embedded systems will not need the splice-family syscalls (splice, vmsplice, tee and sendfile). Omitting them saves space. This adds a new EXPERT config option CONFIG_SYSCALL_SPLICE (default y) to support compiling them out. The goal is to completely compile out fs/splice. To achieve this, the remaining patch-set will deal with fs/splice exports. As far as possible, the impact on other device drivers will be minimized so as to reduce the maintenance burden of CONFIG_SYSCALL_SPLICE. The use of exported functions will be solved by transparently mocking them out with static inlines. Use of the exported pipe_buf_operations struct however require direct modification in fs/fuse and net/core. The next two patches will deal with this. Once all exports are solved, fs/splice can be compiled out. The bloat benefit of this patch given a tinyconfig is: add/remove: 0/16 grow/shrink: 2/5 up/down: 114/-3693 (-3579) function old new delta splice_direct_to_actor 348 416 +68 splice_to_pipe 371 417 +46 splice_from_pipe_next 107 106 -1 fdput 11 - -11 signal_pending 39 26 -13 fdget 56 42 -14 user_page_pipe_buf_ops 20 - -20 user_page_pipe_buf_steal 25 - -25 file_end_write 58 29 -29 file_start_write 68 34 -34 pipe_to_user 43 - -43 wakeup_pipe_readers 54 - -54 do_splice_to 87 - -87 ipipe_prep.part 92 - -92 opipe_prep.part 119 - -119 sys_sendfile 122 - -122 sys_sendfile64 126 - -126 sys_vmsplice 137 - -137 vmsplice_to_user 205 - -205 sys_tee 491 - -491 do_sendfile 492 - -492 vmsplice_to_pipe 558 - -558 sys_splice 1020 - -1020 Signed-off-by: Pieter Smith <pieter@boesman.nl> --- fs/splice.c | 2 ++ init/Kconfig | 10 ++++++++++ kernel/sys_ni.c | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/fs/splice.c b/fs/splice.c index 44b201b..7c4c695 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -1316,6 +1316,7 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, return ret; } +#ifdef CONFIG_SYSCALL_SPLICE static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, struct pipe_inode_info *opipe, size_t len, unsigned int flags); @@ -2200,4 +2201,5 @@ COMPAT_SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, return do_sendfile(out_fd, in_fd, NULL, count, 0); } #endif +#endif diff --git a/init/Kconfig b/init/Kconfig index d811d5f..dec9819 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1571,6 +1571,16 @@ config NTP system clock to an NTP server, you can disable this option to save space. +config SYSCALL_SPLICE + bool "Enable splice/vmsplice/tee/sendfile syscalls" if EXPERT + default y + help + This option enables the splice, vmsplice, tee and sendfile syscalls. These + are used by applications to: move data between buffers and arbitrary file + descriptors; "copy" data between buffers; or copy data from userspace into + buffers. If building an embedded system where no applications use these + syscalls, you can disable this option to save space. + config PCI_QUIRKS default y bool "Enable PCI quirk workarounds" if EXPERT diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index d2f5b00..25d5551 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c @@ -170,6 +170,14 @@ cond_syscall(sys_fstat); cond_syscall(sys_stat); cond_syscall(sys_uname); cond_syscall(sys_olduname); +cond_syscall(sys_vmsplice); +cond_syscall(sys_splice); +cond_syscall(sys_tee); +cond_syscall(sys_sendfile); +cond_syscall(sys_sendfile64); +cond_syscall(compat_sys_vmsplice); +cond_syscall(compat_sys_sendfile); +cond_syscall(compat_sys_sendfile64); /* arch-specific weak syscall entries */ cond_syscall(sys_pciconfig_read); -- 2.1.0 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-23 14:20 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1416690001-20817-1-git-send-email-pieter@boesman.nl> [not found] ` <1416690001-20817-1-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> 2014-11-22 20:59 ` [PATCH 3/6] fs/splice: support compiling out splice-family syscalls Pieter Smith [not found] ` <1416690001-20817-4-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org> 2014-11-22 21:50 ` Josh Triplett 2014-11-23 14:20 [PATCH 0/6] kernel tinification: optionally compile out splice family of syscalls (splice, vmsplice, tee and sendfile) Pieter Smith 2014-11-23 14:20 ` [PATCH 3/6] fs/splice: support compiling out splice-family syscalls Pieter Smith
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).