Re: [PATCH][RFC] splice support

From: Jens Axboe
Date: Thu Mar 30 2006 - 01:58:07 EST


On Thu, Mar 30 2006, Nick Piggin wrote:
> Hi Jens,
>
> Looks nice!
>
> Jens Axboe wrote:
>
> >Hi,
> >
> >Since my initial posting back in December, I've had some private queries
> >about the state of splice support. The state was pretty much that it was
> >a little broken, if one attempted to do file | file splicing. The
> >original patch migrated pages from one file to another in this case,
> >which got vm ugly really quickly. And it wasn't always the right thing
> >to do, since it would mean that splicing file1 to file2 would move
> >file1's page cache to file2. Sometimes this is what you want, sometimes
> >it is
> >
>
> Page migration now generalised vmscan.c and introduced remove_mapping
> function, which should help keep things clean.

Excellent.

> Moving a page onto and off the LRU is an interesting problem, though.
> But possibly you could just leave it on the LRU and transfer the pagecache
> reference over to the pipe. vmscan would find extra pages on the LRU at
> times, but they would go away when pipe releases the page.
>
> Moving a page from a pipe to a filesystem might be harder, because you
> don't know if it came from a filesystem (still on LRU) or not (in which
> case you need to add it to LRU). If only you can keep track of this

Well that, to me, is _the_ hard problem to solve for this. But you
sort-of do know, my plan is/was to add a ->steal() hook to the pipe
buffers that would 'unhook' the page so it was in a clean state to be
added to the LRU/page cache again. If stealing failed, just fall back to
copying (or hard error, let the flags decide).

> information as the page gets passed around... hmm the PG_private will be
> free to use because a filesystem must always drop its buffers before
> remove_mapping can run. One would also need to take care of replacing
> an existing page I guess.
>
> Hmm... I think it can work, falling back to copies if we get stuck
> anywhere.
>
> Unless someone beats me to it, I'll try coding something up when I get
> a bit more free time.

You are more than welcome, I hope to give it a little shot today and see
how it goes.

--
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/