LWN.net Logo

Re: [PATCH] sys_vmsplice

From:  Linus Torvalds <torvalds-AT-osdl.org>
To:  Jens Axboe <axboe-AT-suse.de>
Subject:  Re: [PATCH] sys_vmsplice
Date:  Fri, 21 Apr 2006 13:45:56 -0700 (PDT)
Cc:  linux-kernel-AT-vger.kernel.org, davem-AT-davemloft.net
Archive-link:  Article, Thread



On Fri, 21 Apr 2006, Jens Axboe wrote:
> 
> Here's the first implementation of sys_vmsplice(). I'm attaching a
> little test app as well for playing with it, it's also committed to the
> splice tools repo at:

Btw, I think we'll have to think a bit more about the buffer size issues:

> @@ -345,6 +346,13 @@ static long do_fcntl(int fd, unsigned in
>  	case F_NOTIFY:
>  		err = fcntl_dirnotify(fd, filp, arg);
>  		break;
> +	case F_SETPSZ:
> +		err = -EINVAL;
> +		break;
> +	case F_GETPSZ:
> +		/* this assumes user space can reliably tell PAGE_CACHE_SIZE */
> +		err = PIPE_BUFFERS;
> +		break;

The above obviously isn't incorrect, but it really isn't enough to handle 
the case I was talking about - for somebody to be able to re-use a 
vmsplice'd page, it's not enough that his buffer is bigger than the pipe 
buffer, it needs to be bigger than the end-to-end buffer. Or rather, 
bigger than the "end-to-copy" buffer.

Ie there may be more buffering after the local pipe buffer - other pipes, 
network buffers, etc etc.

It may even be that my idea to try to limit the buffer size just isn't 
workable, and that we need to do it in a page-per-page basis (ie instead 
of depending on the buffer sizes, actually inspect the page and wait for 
it to be flushed all the way).

So while thinking about that, it might be best to forget about the pipe 
buffer size issue until the final solution is clearer. The pipe buffer may 
well be a _part_ of it, though.

		Linus


(Log in to post comments)

Copyright © 2006, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.