public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Ram <linuxram@us.ibm.com>
Cc: linux-kernel@vger.kernel.org,
	Steven Pratt <slpratt@austin.ibm.com>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH 2/2] readahead: improve sequential read detection
Date: Thu, 10 Mar 2005 20:14:27 +0300	[thread overview]
Message-ID: <42308073.CEA0DF75@tv-sign.ru> (raw)
In-Reply-To: 1110412324.4816.89.camel@localhost

Ram wrote:
>
> On Wed, 2005-03-02 at 11:08, Oleg Nesterov wrote:
> >
> >  out:
> > - return newsize;
> > + return ra->prev_page + 1;
>
> This change introduces one key behavioural change in
> page_cache_readahead(). Instead of returning the number-of-pages
> successfully read, it now returns the next-page-index which is yet to be
> read. Was this essential?

The problem is that with this change:
+       if (offset == ra->prev_page && --req_size)
+               ++offset;
we can't just return newsize.

Because the caller of page_cache_readahead(offset, req_size) expects
that returned value is the number-of-pages successfully read from
this original offset.

Consider do_generic_mapping_read() reading two pages at offset 10,
with ra->prev_page == 10.

1st page, index == 10:
	ret_size = page_cache_readahead(10, 2);		// returns 1
	next_index += ret_size;				// next_index == 11

2nd page, index == 11:
	if (index == next_index)			// Yes
		page_cache_readahead(11, 1);		// BOGUS!

It can be solved without behavioural change of course, but it will be
more complex.

> At least, a comment towards this effect at the top of the function is
> worth adding.

Yes, it's my fault. I should have added comment in changelog at least.

Oleg.

      parent reply	other threads:[~2005-03-10 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-02 19:08 [PATCH 2/2] readahead: improve sequential read detection Oleg Nesterov
2005-03-03  2:01 ` Andrew Morton
2005-03-09 23:52 ` Ram
2005-03-10  0:03   ` Steven Pratt
2005-03-10  0:06     ` Ram
2005-03-10 17:14   ` Oleg Nesterov [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=42308073.CEA0DF75@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxram@us.ibm.com \
    --cc=slpratt@austin.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox