diff -urNp x-ref/mm/page_alloc.c x/mm/page_alloc.c --- x-ref/mm/page_alloc.c 2003-02-14 18:40:18.000000000 +0100 +++ x/mm/page_alloc.c 2003-02-14 18:41:00.000000000 +0100 @@ -649,6 +649,41 @@ unsigned int nr_free_highpages (void) } #endif +/* + * If it returns non zero it means there's lots of ram "free" + * (note: not in cache!) so any caller will know that + * he can allocate some memory to do some more aggressive + * (possibly wasteful) readahead. The state of the memory + * should be rechecked after every few pages allocated for + * doing this aggressive readahead. + * + * The gfp_mask parameter specifies in which kind of memory + * the readahead information will be applicated to. + */ +int start_aggressive_readahead(unsigned int gfp_mask) +{ + pg_data_t *pgdat = pgdat_list; + zonelist_t *zonelist; + zone_t **zonep, *zone; + int ret = 0; + + do { + int class_idx; + zonelist = pgdat->node_zonelists + (gfp_mask & GFP_ZONEMASK); + zonep = zonelist->zones; + zone = *(zonep++); + class_idx = zone_idx(zone); + + for (; zone; zone = *(zonep++)) + if (zone->free_pages > zone->watermarks[class_idx].high * 2) + ret = 1; + + pgdat = pgdat->node_next; + } while (pgdat); + + return ret; +} + #define K(x) ((x) << (PAGE_SHIFT-10)) /*