From: Wu Fengguang Introduce a new page flag: PG_readahead. It acts as a look-ahead mark, which tells the page reader: Hey, it's time to invoke the adaptive read-ahead logic! For the sake of I/O pipelining, don't wait until it runs out of cached pages. ;-) Signed-off-by: Wu Fengguang Signed-off-by: Andrew Morton --- include/linux/page-flags.h | 5 +++++ mm/page_alloc.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff -puN include/linux/page-flags.h~mm-introduce-pg_readahead include/linux/page-flags.h --- a/include/linux/page-flags.h~mm-introduce-pg_readahead +++ a/include/linux/page-flags.h @@ -92,6 +92,7 @@ #define PG_buddy 19 /* Page is free, on buddy lists */ #define PG_mlocked 20 /* Page is mlocked */ +#define PG_readahead 21 /* Reminder to do read-ahead */ #if (BITS_PER_LONG > 32) /* @@ -241,6 +242,10 @@ static inline void SetPageUptodate(struc #define ClearPageMlocked(page) clear_bit(PG_mlocked, &(page)->flags) #define __ClearPageMlocked(page) __clear_bit(PG_mlocked, &(page)->flags) +#define PageReadahead(page) test_bit(PG_readahead, &(page)->flags) +#define SetPageReadahead(page) set_bit(PG_readahead, &(page)->flags) +#define ClearPageReadahead(page) clear_bit(PG_readahead, &(page)->flags) + struct page; /* forward declaration */ extern void cancel_dirty_page(struct page *page, unsigned int account_size); diff -puN mm/page_alloc.c~mm-introduce-pg_readahead mm/page_alloc.c --- a/mm/page_alloc.c~mm-introduce-pg_readahead +++ a/mm/page_alloc.c @@ -605,7 +605,7 @@ static int prep_new_page(struct page *pa if (PageReserved(page)) return 1; - page->flags &= ~(1 << PG_uptodate | 1 << PG_error | + page->flags &= ~(1 << PG_uptodate | 1 << PG_error | 1 << PG_readahead | 1 << PG_referenced | 1 << PG_arch_1 | 1 << PG_checked | 1 << PG_mappedtodisk); set_page_private(page, 0); _