From: Peter Zijlstra on
On Fri, 2010-05-14 at 14:32 -0400, Mathieu Desnoyers wrote:

> [CCing memory management specialists]

And jet you forgot Jens who wrote it ;-)

> So I have three questions here:
>
> 1 - could we enforce removal of these pages from the page cache by calling
> "page_cache_release()" before giving these pages back to the ring buffer ?
>
> 2 - or maybe is there a page flag we could specify when we allocate them to
> ask for these pages to never be put in the page cache ? (but they should be
> still usable as write buffers)
>
> 3 - is there something more we need to do to grab a reference on the pages
> before passing them to splice(), so that when we call page_cache_release()
> they don't get reclaimed ?

There is no guarantee it is the pagecache they end up in, it could be a
network packet queue, a pipe, or anything that implements .splice_write.

>From what I understand of splice() is that it assumes it passes
ownership of the page, you're not supposed to touch them again, non of
the above three are feasible.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Mon, 2010-05-17 at 18:42 -0400, Mathieu Desnoyers wrote:
> I'll continue to look into this. One of the things I noticed that that we could
> possibly use the "steal()" operation to steal the pages back from the page cache
> to repopulate the ring buffer rather than continuously allocating new pages. If
> steal() fails for some reasons, then we can fall back on page allocation. I'm
> not sure it is safe to assume anything about pages being in the page cache
> though.

Also, suppose it was still in the page-cache and still dirty, a steal()
would then punch a hole in the file.

> Maybe the safest route is to just allocate new pages for now.

Yes, that seems to be the only sane approach.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Peter Zijlstra on
On Tue, 2010-05-18 at 11:16 -0400, Mathieu Desnoyers wrote:
> > Also, suppose it was still in the page-cache and still dirty, a steal()
> > would then punch a hole in the file.
>
> page_cache_pipe_buf_steal starts by doing a wait_on_page_writeback(page); and
> then does a try_to_release_page(page, GFP_KERNEL). Only if that succeeds is the
> action of stealing succeeding.

If you're going to wait for writeback I don't really see the advantage
of stealing over simply allocating a new page.


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