Skip to contentSkip to conversation

Doc for your Adaptive ReadAhead patch

DISCUSSION Fengguang Wu 1 participant 1 message Apr 11, 2007 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 2 lines · Jin Steve

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.

Quoted 15 lines

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;
}