All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: splice(SPLICE_F_MOVE) problems
Date: Mon, 1 May 2006 19:41:54 +0200	[thread overview]
Message-ID: <20060501174153.GH3814@suse.de> (raw)
In-Reply-To: <20060501190625.GA174@oleg>

On Mon, May 01 2006, Oleg Nesterov wrote:
> On 05/01, Jens Axboe wrote:
> >
> > On Mon, May 01 2006, Oleg Nesterov wrote:
> > > 
> > > I can't understand why do we need PIPE_BUF_FLAG_STOLEN at all.
> > > It seems to me we need a local boolean in pipe_to_file.
> > 
> > PIPE_BUF_FLAG_STOLEN used to be used in the release function as well,
> > hence the flag.
> 
> Ok, but in that case
> 
> >                                               I'll make sure to clear
> > the flag as well on add_to_page_cache() failure.
> 
> ... it is not good to clear it in pipe_to_file(). The page remains
> stolen from pipe_buf_operations pov, this flag imho should be private
> to buf, and page_cache_pipe_buf_ops doesn't need it.
> 
> I think pipe_to_buf() can test 'buf->page == page' instead of
> PIPE_BUF_FLAG_STOLEN.

I ended up fixing it with a local variable, but you are right it can be
killed with just a buf->page != page == stolen check. I got rid of the
last check of that, so just one remaining. Will commit this change.

> Another question,
> 
> 	__generic_file_splice_read:
> 
> 		/*
> 		 * Initiate read-ahead on this page range. however, don't call into
> 		 * read-ahead if this is a non-zero offset (we are likely doing small
> 		 * chunk splice and the page is already there) for a single page.
> 		 */
> 		if (!loff || nr_pages > 1)
> 			page_cache_readahead(mapping, &in->f_ra, in, index, nr_pages);
> 
> Why this check? page_cache_readahead() should detect sub-page
> reads correctly.

Leftover from do_page_cache_readahead I suppose. I probably shouldn't
try to second guess read-ahead, however.

> 		page = find_get_page(mapping, index);
> 		if (!page) {
> 			page = page_cache_alloc_cold();
> 
> 			add_to_page_cache_lru(page);
> 
> I think it makes sense to add handle_ra_miss() here. Otherwise,
> for example, readahead could be disabled by RA_FLAG_INCACHE
> forever.

Good point, added.

> If readahead doesn't work, SPLICE_F_MOVE is problematic too.
> add_to_page_cache_lru()->lru_cache_add() first increments
> page->count and adds this page to lru_add_pvecs. This means
> page_cache_pipe_buf_steal()->remove_mapping() will probably
> fail.

Because of the temporarily elevated page count?

-- 
Jens Axboe


  reply	other threads:[~2006-05-01 17:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-01  6:59 splice(SPLICE_F_MOVE) problems Oleg Nesterov
2006-05-01  6:54 ` Jens Axboe
2006-05-01 19:06   ` Oleg Nesterov
2006-05-01 17:41     ` Jens Axboe [this message]
2006-05-02  0:11       ` Oleg Nesterov
2006-05-02  5:28         ` Jens Axboe
2006-05-03  4:14           ` Oleg Nesterov
2006-05-03  6:56             ` Jens Axboe
2006-05-03 14:35               ` Oleg Nesterov
2006-05-03 10:48                 ` Jens Axboe

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=20060501174153.GH3814@suse.de \
    --to=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --cc=torvalds@osdl.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.