linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	viro@zeniv.linux.org.uk
Subject: Re: [PATCH 4/5] splice: increase pipe size in splice_direct_to_actor()
Date: Mon, 19 Nov 2018 23:49:20 -0800	[thread overview]
Message-ID: <20181120074920.GB25418@infradead.org> (raw)
In-Reply-To: <20181119211742.8824-5-david@fromorbit.com>

[adding Al for pipe bits]

On Tue, Nov 20, 2018 at 08:17:41AM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> When copy_file_range() is called on files that have been opened with
> O_DIRECT, do_splice_direct() does a manual copy of the range one
> pipe buffer at a time. The default is 16 pages, which means on
> x86_64 it is limited to 64kB IO. This is extremely slow - 64k
> synchrnous read/write will run at maybe 5-10MB/s on a spinning disk
> and be seek bound. It will be faster on SSDs, but still very
> inefficient.
> 
> Increase the pipe size to the maximum allowed user size so that we
> can get decent throughput for this highly sub-optimal copy loop.  We
> also don't care if changing the pipe size fails - that will just
> result in a slower copy.
> 
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
>  fs/pipe.c                 | 2 +-
>  fs/splice.c               | 8 ++++++++
>  include/linux/pipe_fs_i.h | 1 +
>  3 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/pipe.c b/fs/pipe.c
> index bdc5d3c0977d..5885d29cdaa6 100644
> --- a/fs/pipe.c
> +++ b/fs/pipe.c
> @@ -1025,7 +1025,7 @@ unsigned int round_pipe_size(unsigned long size)
>   * Allocate a new array of pipe buffers and copy the info over. Returns the
>   * pipe size if successful, or return -ERROR on error.
>   */
> -static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)
> +long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg)
>  {
>  	struct pipe_buffer *bufs;
>  	unsigned int size, nr_pages;
> diff --git a/fs/splice.c b/fs/splice.c
> index 3553f1956508..64dcc622db8d 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -34,6 +34,7 @@
>  #include <linux/socket.h>
>  #include <linux/compat.h>
>  #include <linux/sched/signal.h>
> +#include <linux/pipe_fs_i.h>
>  
>  #include "internal.h"
>  
> @@ -931,6 +932,13 @@ ssize_t splice_direct_to_actor(struct file *in, struct splice_desc *sd,
>  		current->splice_pipe = pipe;
>  	}
>  
> +	/*
> +	 * Try to increase the data holding capacity of the pipe so we can do
> +	 * larger IOs. This may not increase the size at all because maximum
> +	 * user pipe size is administrator controlled, but we still should try.
> +	 */
> +	pipe_set_size(pipe, pipe_max_size);
> +
>  	/*
>  	 * Do the splice.
>  	 */
> diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
> index 5a3bb3b7c9ad..e7d728e5b5f8 100644
> --- a/include/linux/pipe_fs_i.h
> +++ b/include/linux/pipe_fs_i.h
> @@ -191,5 +191,6 @@ struct pipe_inode_info *get_pipe_info(struct file *file);
>  
>  int create_pipe_files(struct file **, int);
>  unsigned int round_pipe_size(unsigned long size);
> +long pipe_set_size(struct pipe_inode_info *pipe, unsigned long arg);
>  
>  #endif
> -- 
> 2.19.1
> 
---end quoted text---

  reply	other threads:[~2018-11-20 18:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-19 21:17 [PATCH 0/5] iomap: data corruption fixes and more Dave Chinner
2018-11-19 21:17 ` [PATCH 1/5] iomap: FUA is wrong for DIO O_DSYNC writes into unwritten extents Dave Chinner
2018-11-20  7:48   ` Christoph Hellwig
2018-11-20 23:00   ` Darrick J. Wong
2018-11-19 21:17 ` [PATCH 2/5] iomap: sub-block dio needs to zeroout beyond EOF Dave Chinner
2018-11-20 23:01   ` Darrick J. Wong
2018-11-19 21:17 ` [PATCH 3/5] iomap: dio data corruption and spurious errors when pipes fill Dave Chinner
2018-11-19 21:17 ` [PATCH 4/5] splice: increase pipe size in splice_direct_to_actor() Dave Chinner
2018-11-20  7:49   ` Christoph Hellwig [this message]
2018-11-20 23:02   ` Darrick J. Wong
2018-11-19 21:17 ` [PATCH 5/5] vfs: vfs_dedupe_file_range() doesn't return EOPNOTSUPP Dave Chinner
2018-11-20  7:49   ` Christoph Hellwig
2018-11-21  6:50 ` [PATCH 6/5] iomap: readpages doesn't zero page tail beyond EOF properly Dave Chinner
2018-11-21  8:27   ` [PATCH 6/5 V2] " Dave Chinner
2018-11-21 16:20     ` Darrick J. Wong
2018-11-21 16:34     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181120074920.GB25418@infradead.org \
    --to=hch@infradead.org \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).