lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070612184826.GS18832@kernel.dk>
Date:	Tue, 12 Jun 2007 20:48:26 +0200
From:	Jens Axboe <jens.axboe@...cle.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org
Subject: Re: splice: move balance_dirty_pages_ratelimited() outside of      splice actor

On Tue, Jun 12 2007, Andrew Morton wrote:
> On Tue, 12 Jun 2007 20:15:41 +0200
> Jens Axboe <jens.axboe@...cle.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@...cle.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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ