linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vmsplice: relax alignement requirements for SPLICE_F_GIFT
@ 2012-04-04  9:08 Eric Dumazet
  2012-04-20  8:19 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-04-04  9:08 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-kernel, David Miller, netdev, Tom Herbert, Al Viro,
	Hugh Dickins, Changli Gao, Andrew Morton, Miklos Szeredi

It seems there is no fundamental reason to limit vmsplice()
SPLICE_F_GIFT to page aligned chunks.

All helpers are prepared to cope with offsets in page.

This limitation makes vmsplice() API very impractical in the zero-copy
land.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Tom Herbert <therbert@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: David Miller <davem@davemloft.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Hugh Dickins <hughd@google.com>
Cc: Changli Gao <xiaosuo@gmail.com>
Cc: Miklos Szeredi <mszeredi@suse.cz>
---
 fs/splice.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/splice.c b/fs/splice.c
index 5f883de..5417aa3 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1385,7 +1385,7 @@ static long do_splice(struct file *in, loff_t __user *off_in,
  */
 static int get_iovec_page_array(const struct iovec __user *iov,
 				unsigned int nr_vecs, struct page **pages,
-				struct partial_page *partial, int aligned,
+				struct partial_page *partial, bool aligned,
 				unsigned int pipe_buffers)
 {
 	int buffers = 0, error = 0;
@@ -1623,7 +1623,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
 		return -ENOMEM;
 
 	spd.nr_pages = get_iovec_page_array(iov, nr_segs, spd.pages,
-					    spd.partial, flags & SPLICE_F_GIFT,
+					    spd.partial, false,
 					    pipe->buffers);
 	if (spd.nr_pages <= 0)
 		ret = spd.nr_pages;



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

* Re: [PATCH] vmsplice: relax alignement requirements for SPLICE_F_GIFT
  2012-04-04  9:08 [PATCH] vmsplice: relax alignement requirements for SPLICE_F_GIFT Eric Dumazet
@ 2012-04-20  8:19 ` Jens Axboe
  2012-04-20  8:35   ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2012-04-20  8:19 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: linux-kernel, David Miller, netdev, Tom Herbert, Al Viro,
	Hugh Dickins, Changli Gao, Andrew Morton, Miklos Szeredi

On Wed, Apr 04 2012, Eric Dumazet wrote:
> It seems there is no fundamental reason to limit vmsplice()
> SPLICE_F_GIFT to page aligned chunks.
> 
> All helpers are prepared to cope with offsets in page.
> 
> This limitation makes vmsplice() API very impractical in the zero-copy
> land.

Sorry for the slow reply on this one. It's been a long time since I
wrote that code... If I recall correctly, the reason it currently
requires alignment, is that a gifted page is no longer yours, by
definition. So the alignment check was to ensure that we gift full
pages. But if the caller screws that up, I guess it's the callers
problem and it's a shame to limit the API in this way.

I will apply it for 3.5.

-- 
Jens Axboe


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

* Re: [PATCH] vmsplice: relax alignement requirements for SPLICE_F_GIFT
  2012-04-20  8:19 ` Jens Axboe
@ 2012-04-20  8:35   ` Eric Dumazet
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2012-04-20  8:35 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-kernel, David Miller, netdev, Tom Herbert, Al Viro,
	Hugh Dickins, Changli Gao, Andrew Morton, Miklos Szeredi

On Fri, 2012-04-20 at 10:19 +0200, Jens Axboe wrote:
> On Wed, Apr 04 2012, Eric Dumazet wrote:
> > It seems there is no fundamental reason to limit vmsplice()
> > SPLICE_F_GIFT to page aligned chunks.
> > 
> > All helpers are prepared to cope with offsets in page.
> > 
> > This limitation makes vmsplice() API very impractical in the zero-copy
> > land.
> 
> Sorry for the slow reply on this one. It's been a long time since I
> wrote that code... If I recall correctly, the reason it currently
> requires alignment, is that a gifted page is no longer yours, by
> definition. So the alignment check was to ensure that we gift full
> pages. But if the caller screws that up, I guess it's the callers
> problem and it's a shame to limit the API in this way.
> 
> I will apply it for 3.5.
> 

Thanks Jens 



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

end of thread, other threads:[~2012-04-20  8:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-04  9:08 [PATCH] vmsplice: relax alignement requirements for SPLICE_F_GIFT Eric Dumazet
2012-04-20  8:19 ` Jens Axboe
2012-04-20  8:35   ` Eric Dumazet

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