linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] fs: Support compiling out sendfile
       [not found] ` <1413841728-1313-1-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org>
@ 2014-10-20 21:48   ` Pieter Smith
  2014-10-20 22:24     ` josh
       [not found]     ` <54467D9C.2030302@zytor.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Pieter Smith @ 2014-10-20 21:48 UTC (permalink / raw)
  To: Alexander Viro
  Cc: Josh Triplett, Pieter Smith, Andrew Morton, Eric Paris,
	Matt Turner, Michal Hocko, Paul E. McKenney, Fabian Frederick,
	Tejun Heo, 蔡正龙, Luis R. Rodriguez,
	Peter Foley, Konstantin Khlebnikov, Eric W. Biederman,
	H. Peter Anvin, Oleg Nesterov, Andy Lutomirski, David Herrmann,
	Kees Cook, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, open list,
	open list:ABI/API

Many embedded systems will not need this syscall, and omitting it
saves space.  Add a new EXPERT config option CONFIG_SENDFILE_SYSCALL
(default y) to support compiling it out.

bloat-o-meter:
add/remove: 0/4 grow/shrink: 5/0 up/down: 23/-751 (-728)
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
fdput                                         11       -     -11
sys_sendfile                                 122       -    -122
sys_sendfile64                               126       -    -126
do_sendfile                                  492       -    -492

Signed-off-by: Pieter Smith <pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org>
---
 fs/Makefile     |  3 ++-
 init/Kconfig    | 10 ++++++++++
 kernel/sys_ni.c |  4 ++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/fs/Makefile b/fs/Makefile
index 1e3423f..1bbfea7 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -5,7 +5,7 @@
 # Rewritten to use lists instead of if-statements.
 # 
 
-obj-y :=	open.o read_write.o sendfile.o file_table.o super.o \
+obj-y :=	open.o read_write.o file_table.o super.o \
 		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
 		ioctl.o readdir.o select.o dcache.o inode.o \
 		attr.o bad_inode.o file.o filesystems.o namespace.o \
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMPAT_BINFMT_ELF)	+= compat_binfmt_elf.o
 obj-$(CONFIG_BINFMT_ELF_FDPIC)	+= binfmt_elf_fdpic.o
 obj-$(CONFIG_BINFMT_SOM)	+= binfmt_som.o
 obj-$(CONFIG_BINFMT_FLAT)	+= binfmt_flat.o
+obj-$(CONFIG_SENDFILE_SYSCALL)	+= sendfile.o
 
 obj-$(CONFIG_FS_MBCACHE)	+= mbcache.o
 obj-$(CONFIG_FS_POSIX_ACL)	+= posix_acl.o
diff --git a/init/Kconfig b/init/Kconfig
index 782a65b..df6785c 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -1547,6 +1547,16 @@ config ADVISE_SYSCALLS
 	  applications use these syscalls, you can disable this option to save
 	  space.
 
+config SENDFILE_SYSCALL
+	bool "Enable sendfile syscall" if EXPERT
+	default y
+	help
+	  This option enables the sendfile syscall, used by applications to copy
+	  data between file descriptors. Because sendfile performs the copying
+	  within the kernel, it is more efficient than the combination of read
+	  and write.  If building an embedded system where no applications use
+	  the sendfile syscall, 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 d4709d4..b068de7 100644
--- a/kernel/sys_ni.c
+++ b/kernel/sys_ni.c
@@ -159,6 +159,10 @@ cond_syscall(sys_uselib);
 cond_syscall(sys_fadvise64);
 cond_syscall(sys_fadvise64_64);
 cond_syscall(sys_madvise);
+cond_syscall(sys_sendfile);
+cond_syscall(sys_sendfile64);
+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] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
  2014-10-20 21:48   ` [PATCH 2/2] fs: Support compiling out sendfile Pieter Smith
@ 2014-10-20 22:24     ` josh
  2014-10-21  7:51       ` Christoph Hellwig
       [not found]     ` <54467D9C.2030302@zytor.com>
  1 sibling, 1 reply; 7+ messages in thread
From: josh @ 2014-10-20 22:24 UTC (permalink / raw)
  To: Pieter Smith
  Cc: Alexander Viro, Andrew Morton, Eric Paris, Matt Turner,
	Michal Hocko, Paul E. McKenney, Fabian Frederick, Tejun Heo,
	蔡正龙, Luis R. Rodriguez, Peter Foley,
	Konstantin Khlebnikov, Eric W. Biederman, H. Peter Anvin,
	Oleg Nesterov, Andy Lutomirski, David Herrmann, Kees Cook,
	linux-fsdevel, open list, open list:ABI/API

On Mon, Oct 20, 2014 at 11:48:37PM +0200, Pieter Smith wrote:
> Many embedded systems will not need this syscall, and omitting it
> saves space.  Add a new EXPERT config option CONFIG_SENDFILE_SYSCALL
> (default y) to support compiling it out.

Nice work, thanks!

If there are no objections, and nobody has a tree they'd rather carry
this through, I'll take the series through the tiny tree when it's ready
to merge.

> bloat-o-meter:
> add/remove: 0/4 grow/shrink: 5/0 up/down: 23/-751 (-728)
> 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
> fdput                                         11       -     -11
> sys_sendfile                                 122       -    -122
> sys_sendfile64                               126       -    -126
> do_sendfile                                  492       -    -492

Interesting inlining decisions by GCC here.  Got a bloat-o-meter for the
two-patch series, by any chance?  (Also, is this with tinyconfig?  In
particular, with OPTIMIZE_INLINING and OPTIMIZE_FOR_SIZE?)  I'm
wondering if moving sendfile to a separate file made GCC put fdput
out-of-line, and compiling it out reversed that again.

> Signed-off-by: Pieter Smith <pieter@boesman.nl>

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> ---
>  fs/Makefile     |  3 ++-
>  init/Kconfig    | 10 ++++++++++
>  kernel/sys_ni.c |  4 ++++
>  3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/Makefile b/fs/Makefile
> index 1e3423f..1bbfea7 100644
> --- a/fs/Makefile
> +++ b/fs/Makefile
> @@ -5,7 +5,7 @@
>  # Rewritten to use lists instead of if-statements.
>  # 
>  
> -obj-y :=	open.o read_write.o sendfile.o file_table.o super.o \
> +obj-y :=	open.o read_write.o file_table.o super.o \
>  		char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
>  		ioctl.o readdir.o select.o dcache.o inode.o \
>  		attr.o bad_inode.o file.o filesystems.o namespace.o \
> @@ -38,6 +38,7 @@ obj-$(CONFIG_COMPAT_BINFMT_ELF)	+= compat_binfmt_elf.o
>  obj-$(CONFIG_BINFMT_ELF_FDPIC)	+= binfmt_elf_fdpic.o
>  obj-$(CONFIG_BINFMT_SOM)	+= binfmt_som.o
>  obj-$(CONFIG_BINFMT_FLAT)	+= binfmt_flat.o
> +obj-$(CONFIG_SENDFILE_SYSCALL)	+= sendfile.o
>  
>  obj-$(CONFIG_FS_MBCACHE)	+= mbcache.o
>  obj-$(CONFIG_FS_POSIX_ACL)	+= posix_acl.o
> diff --git a/init/Kconfig b/init/Kconfig
> index 782a65b..df6785c 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1547,6 +1547,16 @@ config ADVISE_SYSCALLS
>  	  applications use these syscalls, you can disable this option to save
>  	  space.
>  
> +config SENDFILE_SYSCALL
> +	bool "Enable sendfile syscall" if EXPERT
> +	default y
> +	help
> +	  This option enables the sendfile syscall, used by applications to copy
> +	  data between file descriptors. Because sendfile performs the copying
> +	  within the kernel, it is more efficient than the combination of read
> +	  and write.  If building an embedded system where no applications use
> +	  the sendfile syscall, you can disable this option to save space.
> +

I'm thinking of adding a submenu to group config FOO_SYSCALL options. :)
I'll probably push that as part of the 3.19 merge window, as a patch on
top of all of the individual tinification options.

>  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 d4709d4..b068de7 100644
> --- a/kernel/sys_ni.c
> +++ b/kernel/sys_ni.c
> @@ -159,6 +159,10 @@ cond_syscall(sys_uselib);
>  cond_syscall(sys_fadvise64);
>  cond_syscall(sys_fadvise64_64);
>  cond_syscall(sys_madvise);
> +cond_syscall(sys_sendfile);
> +cond_syscall(sys_sendfile64);
> +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] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
  2014-10-20 22:24     ` josh
@ 2014-10-21  7:51       ` Christoph Hellwig
  2014-10-21  9:04         ` Josh Triplett
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2014-10-21  7:51 UTC (permalink / raw)
  To: josh-iaAMLnmF4UmaiuxdJuQwMA
  Cc: Pieter Smith, Alexander Viro, Andrew Morton, Eric Paris,
	Matt Turner, Michal Hocko, Paul E. McKenney, Fabian Frederick,
	Tejun Heo, ?????????, Luis R. Rodriguez, Peter Foley,
	Konstantin Khlebnikov, Eric W. Biederman, H. Peter Anvin,
	Oleg Nesterov, Andy Lutomirski, David Herrmann, Kees Cook,
	linux-fsdevel-u79uwXL29TY76Z2rM5mHXA, open list,
	open list:ABI/API

On Mon, Oct 20, 2014 at 03:24:22PM -0700, josh-iaAMLnmF4UmaiuxdJuQwMA@public.gmane.org wrote:
> On Mon, Oct 20, 2014 at 11:48:37PM +0200, Pieter Smith wrote:
> > Many embedded systems will not need this syscall, and omitting it
> > saves space.  Add a new EXPERT config option CONFIG_SENDFILE_SYSCALL
> > (default y) to support compiling it out.
> 
> Nice work, thanks!
> 
> If there are no objections, and nobody has a tree they'd rather carry
> this through, I'll take the series through the tiny tree when it's ready
> to merge.

I think it's rather pointless - there is very little sendfile code,
so you'd rather want to disable splice.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
  2014-10-21  7:51       ` Christoph Hellwig
@ 2014-10-21  9:04         ` Josh Triplett
  2014-10-21  9:13           ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Josh Triplett @ 2014-10-21  9:04 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Pieter Smith, Alexander Viro, Andrew Morton, Eric Paris,
	Matt Turner, Michal Hocko, Paul E. McKenney, Fabian Frederick,
	Tejun Heo, ?????????, Luis R. Rodriguez, Peter Foley,
	Konstantin Khlebnikov, Eric W. Biederman, H. Peter Anvin,
	Oleg Nesterov, Andy Lutomirski, David Herrmann, Kees Cook,
	linux-fsdevel, open list, open list:ABI/API

On Tue, Oct 21, 2014 at 12:51:54AM -0700, Christoph Hellwig wrote:
> On Mon, Oct 20, 2014 at 03:24:22PM -0700, josh@joshtriplett.org wrote:
> > On Mon, Oct 20, 2014 at 11:48:37PM +0200, Pieter Smith wrote:
> > > Many embedded systems will not need this syscall, and omitting it
> > > saves space.  Add a new EXPERT config option CONFIG_SENDFILE_SYSCALL
> > > (default y) to support compiling it out.
> > 
> > Nice work, thanks!
> > 
> > If there are no objections, and nobody has a tree they'd rather carry
> > this through, I'll take the series through the tiny tree when it's ready
> > to merge.
> 
> I think it's rather pointless - there is very little sendfile code,
> so you'd rather want to disable splice.

That's the plan, but since sendfile depends on some of the splice bits,
sendfile needs to be optional as well; SENDFILE_SYSCALL will then select
SPLICE_SYSCALLS.

- Josh Triplett

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
  2014-10-21  9:04         ` Josh Triplett
@ 2014-10-21  9:13           ` Christoph Hellwig
  2014-10-21  9:50             ` Josh Triplett
  0 siblings, 1 reply; 7+ messages in thread
From: Christoph Hellwig @ 2014-10-21  9:13 UTC (permalink / raw)
  To: Josh Triplett
  Cc: Christoph Hellwig, Pieter Smith, Alexander Viro, Andrew Morton,
	Eric Paris, Matt Turner, Michal Hocko, Paul E. McKenney,
	Fabian Frederick, Tejun Heo, ?????????, Luis R. Rodriguez,
	Peter Foley, Konstantin Khlebnikov, Eric W. Biederman,
	H. Peter Anvin, Oleg Nesterov, Andy Lutomirski, David Herrmann,
	Kees Cook, linux-fsdevel, open list, open list:ABI/API

On Tue, Oct 21, 2014 at 02:04:22AM -0700, Josh Triplett wrote:
> That's the plan, but since sendfile depends on some of the splice bits,
> sendfile needs to be optional as well; SENDFILE_SYSCALL will then select
> SPLICE_SYSCALLS.

Just include sendfile with the splice syscalls - we don't really need a
config option for every obscure syscall.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
  2014-10-21  9:13           ` Christoph Hellwig
@ 2014-10-21  9:50             ` Josh Triplett
  0 siblings, 0 replies; 7+ messages in thread
From: Josh Triplett @ 2014-10-21  9:50 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Pieter Smith, Alexander Viro, Andrew Morton, Eric Paris,
	Matt Turner, Michal Hocko, Paul E. McKenney, Fabian Frederick,
	Tejun Heo, ?????????, Luis R. Rodriguez, Peter Foley,
	Konstantin Khlebnikov, Eric W. Biederman, H. Peter Anvin,
	Oleg Nesterov, Andy Lutomirski, David Herrmann, Kees Cook,
	linux-fsdevel, open list, open list:ABI/API

On Tue, Oct 21, 2014 at 02:13:56AM -0700, Christoph Hellwig wrote:
> On Tue, Oct 21, 2014 at 02:04:22AM -0700, Josh Triplett wrote:
> > That's the plan, but since sendfile depends on some of the splice bits,
> > sendfile needs to be optional as well; SENDFILE_SYSCALL will then select
> > SPLICE_SYSCALLS.
> 
> Just include sendfile with the splice syscalls - we don't really need a
> config option for every obscure syscall.

No objection here.  Pieter, since you're planning to remove splice
anyway, can you just fold the two together under the same Kconfig
option?  That should simplify the patch series, since you won't need to
split the two.

- Josh Triplett

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] fs: Support compiling out sendfile
       [not found]       ` <20141021171814.GA14704@cloud>
@ 2014-10-21 17:20         ` Eric Paris
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Paris @ 2014-10-21 17:20 UTC (permalink / raw)
  To: josh
  Cc: H. Peter Anvin, Pieter Smith, Alexander Viro, Andrew Morton,
	Matt Turner, Michal Hocko, Paul E. McKenney, Fabian Frederick,
	Tejun Heo, 蔡正龙, Luis R. Rodriguez,
	Peter Foley, Konstantin Khlebnikov, Eric W. Biederman,
	Oleg Nesterov, Andy Lutomirski, David Herrmann, Kees Cook,
	linux-fsdevel, open list, ABI/API

On Tue, 2014-10-21 at 10:18 -0700, josh@joshtriplett.org wrote:
> On Tue, Oct 21, 2014 at 08:37:00AM -0700, H. Peter Anvin wrote:
> > On 10/20/2014 02:48 PM, Pieter Smith wrote:
> > > Many embedded systems will not need this syscall, and omitting it
> > > saves space.  Add a new EXPERT config option CONFIG_SENDFILE_SYSCALL
> > > (default y) to support compiling it out.
> > 
> > <bikeshed>
> > I believe these options ought to be CONFIG_SYSCALL_*
> > </bikeshed>
> 
> I agree.  I think people started using CONFIG_*_SYSCALL because of
> things like AUDITSYSCALL 

AUDITSYSCALL audits syscalls.  It doesn't actually implement any
syscalls.  You are right about SYSFS_SYSCALL though...

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-10-21 17:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1413841728-1313-1-git-send-email-pieter@boesman.nl>
     [not found] ` <1413841728-1313-1-git-send-email-pieter-qeJ+1H9vRZbz+pZb47iToQ@public.gmane.org>
2014-10-20 21:48   ` [PATCH 2/2] fs: Support compiling out sendfile Pieter Smith
2014-10-20 22:24     ` josh
2014-10-21  7:51       ` Christoph Hellwig
2014-10-21  9:04         ` Josh Triplett
2014-10-21  9:13           ` Christoph Hellwig
2014-10-21  9:50             ` Josh Triplett
     [not found]     ` <54467D9C.2030302@zytor.com>
     [not found]       ` <20141021171814.GA14704@cloud>
2014-10-21 17:20         ` Eric Paris

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).