On Sat, Jun 04, 2011 at 11:15:38AM +0800, Hugh Dickins wrote: > On Fri, Jun 3, 2011 at 4:55 AM, Matthew Wilcox <willy@xxxxxxxxxxxxxxx> wrote: > > The exact definition of PageReadahead doesn't seem to be documented > > anywhere. ÂI'm assuming it means "This page was not directly requested; > > it is being read for prefetching purposes", exactly like the READA > > semantics. > > > > If my interpretation is correct, then the implementation in > > __do_page_cache_readahead is wrong: > > > > Â Â Â Â Â Â Â Âif (page_idx == nr_to_read - lookahead_size) > > Â Â Â Â Â Â Â Â Â Â Â ÂSetPageReadahead(page); > > > > It'll only set the PageReadahead bit on one page. ÂThe patch below fixes > > this ... if my understanding is correct. > > Incorrect I believe: it's a trigger to say, when you get this far, > it's time to think about kicking off the next read. That's right. PG_readahead is set to trigger the _next_ ASYNC readahead. > > > > If my understanding is wrong, then how are readpage/readpages > > implementations supposed to know that the VM is only prefetching these > > pages, and they're not as important as metadata (dependent) reads? > > I don't think they do know at present; but I can well imagine there > may be advantage in them knowing. __do_page_cache_readahead() don't know whether the _current_ readahead IO is an ASYNC one. page_cache_async_readahead() calls ondemand_readahead() with hit_readahead_marker=true. It's possible to further pass this information into __do_page_cache_readahead() and ->readpage/readpages. Thanks, Fengguang -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>