From: Jens Axboe <jens.axboe@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>, linux-kernel@vger.kernel.org
Subject: Re: splice: move balance_dirty_pages_ratelimited() outside of splice actor
Date: Tue, 12 Jun 2007 20:48:26 +0200 [thread overview]
Message-ID: <20070612184826.GS18832@kernel.dk> (raw)
In-Reply-To: <20070612114322.dfb4e90c.akpm@linux-foundation.org>
On Tue, Jun 12 2007, Andrew Morton wrote:
> On Tue, 12 Jun 2007 20:15:41 +0200
> Jens Axboe <jens.axboe@oracle.com> wrote:
>
> > On Tue, Jun 12 2007, Jens Axboe wrote:
> > > On Tue, Jun 12 2007, Andrew Morton wrote:
> > > > On Tue, 12 Jun 2007 14:44:50 +0200 Jens Axboe <jens.axboe@oracle.com> wrote:
> > > >
> > > > > splice
> > > >
> > > > btw, I'm staring in profound mystification at this:
> > > >
> > > > int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
> > > > struct pipe_buffer *buf)
> > > > {
> > > > struct page *page = buf->page;
> > > >
> > > > if (page_count(page) == 1) {
> > > > lock_page(page);
> > > > return 0;
> > > > }
> > > >
> > > > return 1;
> > > > }
> > > >
> > > >
> > > > afacit that `if page_count(page)' test could be replaced by
> > > > `if today_is_tuesday()'. But then I don't have the foggiest idea
> > > > what it's trying to do.
> > > >
> > > > It would be nice to get some comments in and around here.
> > > >
> > > > Also, I was trying to work out the role and responsibility of the ->pin
> > > > callback, and gave up.
> > > >
> > > > There isn't a lot of point in explaining this over email - one should be
> > > > able to gain an understanding of these things by reading the code. I think
> > > > the best way of tackling this would be to comprehensively document
> > > > pipe_buf_operations and pipe_inode_info, please...
> > >
> > > OK so I wont explain it in detail here, I'll write up a good set of
> > > comments tonight.
> >
> > I'll merge this into the #splice branch.
>
> Great, thanks.
>
> > +/**
> > + * generic_pipe_buf_steal - attempt to take ownership of a @pipe_buffer
> > + * @pipe: the pipe that the buffer belongs to
> > + * @buf: the buffer to attempt to steal
> > + *
> > + * Description:
> > + * This function attempts to steal the @struct page attached to
> > + * @buf. If successful, this function returns 0 and returns with
> > + * the page locked. The caller may then reuse the page for whatever
> > + * he wishes, the typical use is insertion into a different file
> > + * page cache.
> > + */
> > int generic_pipe_buf_steal(struct pipe_inode_info *pipe,
> > struct pipe_buffer *buf)
> > {
> > struct page *page = buf->page;
> >
> > + /*
> > + * A reference of one is golden, that means that the owner of this
> > + * page is the only one holding a reference to it. lock the page
> > + * and return OK.
> > + */
> > if (page_count(page) == 1) {
> > lock_page(page);
> > return 0;
>
> I still don't get this code. I guess I should have asked for pipe_buffer
> docs too ;)
I just love commenting stuff, so I'll treat you to a pipe_buffer
commentary as well :-)
> What sorts of pages can find themselves inside a pipe_buffer, and which of
> these types of pages is the above test detecting?
Any type of page, really. But for generic_pipe_buf_steal(), it's a page
allocated through alloc_page(). The ops must match the buf contents
(hence it's placed in the pipe_buffer, not the pipe itself). So if you
shoving different pages in there, then your steal function (and others)
must reflect that.
--
Jens Axboe
prev parent reply other threads:[~2007-06-12 18:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200706112159.l5BLxF5x004043@hera.kernel.org>
2007-06-11 23:34 ` splice: move balance_dirty_pages_ratelimited() outside of splice actor Andrew Morton
2007-06-12 6:35 ` Jens Axboe
2007-06-12 11:20 ` Jens Axboe
2007-06-12 11:31 ` Jens Axboe
2007-06-12 12:06 ` Peter Zijlstra
2007-06-12 12:10 ` Jens Axboe
2007-06-12 12:16 ` Peter Zijlstra
2007-06-12 12:44 ` Jens Axboe
2007-06-12 16:02 ` Andrew Morton
2007-06-12 16:46 ` Andrew Morton
2007-06-12 17:32 ` Jens Axboe
2007-06-12 18:15 ` Jens Axboe
2007-06-12 18:43 ` Andrew Morton
2007-06-12 18:48 ` Jens Axboe [this message]
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=20070612184826.GS18832@kernel.dk \
--to=jens.axboe@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.