public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Doc for your Adaptive ReadAhead patch
       [not found]   ` <20070411061540.GA5890@mail.ustc.edu.cn>
@ 2007-04-11  6:15     ` Fengguang Wu
  0 siblings, 0 replies; only message in thread
From: Fengguang Wu @ 2007-04-11  6:15 UTC (permalink / raw)
  To: Jin Steve; +Cc: linux-kernel

On Wed, Apr 11, 2007 at 04:44:34AM +0000, Jin Steve wrote:
> Just like the function check_ra_success: (Does it mean: last time 
> RA>VM_MAX_CACHE_HIT, so next time no need readahead?)

The cache hit logic is to prevent doing pointless readahead for
an already cached file: the pages are already there.

VM_MAX_CACHE_HIT is the threshold to disable readahead in this case.

> static inline int check_ra_success(struct file_ra_state *ra,
> 			unsigned long nr_to_read, unsigned long actual)
> {
> 	if (actual == 0) {
> 		ra->cache_hit += nr_to_read;
> 		if (ra->cache_hit >= VM_MAX_CACHE_HIT) {
> 			ra_off(ra);
> 			ra->flags |= RA_FLAG_INCACHE;
> 			return 0;
> 		}
> 	} else {
> 		ra->cache_hit=0;
> 	}
> 	return 1;
> }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-04-11  6:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20070411042707.GC11400@mail.ustc.edu.cn>
     [not found] ` <BAY128-F4C8C995FA1398AE0DF231B55F0@phx.gbl>
     [not found]   ` <20070411061540.GA5890@mail.ustc.edu.cn>
2007-04-11  6:15     ` Doc for your Adaptive ReadAhead patch Fengguang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox