The patch titled readahead: state based method - aging accounting has been added to the -mm tree. Its filename is readahead-state-based-method-aging-accounting.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: readahead: state based method - aging accounting From: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Collect info about the global available memory and its consumption speed. The data are used by the stateful method to estimate the thrashing threshold. They are the decisive factor of the correctness/accuracy of the resulting read-ahead size. The accountings are done on a per-node basis. On NUMA systems, it works for the two common real-world schemes: - the reader process allocates caches in a node affined manner; - the reader process allocates caches _balancely_ from a set of nodes. [clameter@xxxxxxx: Apply type enum zone_type] Signed-off-by: Wu Fengguang <wfg@xxxxxxxxxxxxxxxx> Signed-off-by: Christoph Lameter <clameter@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- include/linux/mmzone.h | 3 +++ mm/page_alloc.c | 31 +++++++++++++++++++++++++++++++ mm/vmscan.c | 1 + 3 files changed, 35 insertions(+) diff -puN include/linux/mmzone.h~readahead-state-based-method-aging-accounting include/linux/mmzone.h --- a/include/linux/mmzone.h~readahead-state-based-method-aging-accounting +++ a/include/linux/mmzone.h @@ -218,6 +218,7 @@ struct zone { unsigned long nr_active; unsigned long nr_inactive; unsigned long pages_scanned; /* since last reclaim */ + unsigned long total_scanned; /* accumulated, may overflow */ int all_unreclaimable; /* All pages pinned */ /* A count of how many reclaimers are scanning this zone */ @@ -464,6 +465,8 @@ void __get_zone_counts(unsigned long *ac unsigned long *free, struct pglist_data *pgdat); void get_zone_counts(unsigned long *active, unsigned long *inactive, unsigned long *free); +unsigned long nr_free_inactive_pages_node(int nid); +unsigned long nr_scanned_pages_node(int nid); void build_all_zonelists(void); void wakeup_kswapd(struct zone *zone, int order); int zone_watermark_ok(struct zone *z, int order, unsigned long mark, diff -puN mm/page_alloc.c~readahead-state-based-method-aging-accounting mm/page_alloc.c --- a/mm/page_alloc.c~readahead-state-based-method-aging-accounting +++ a/mm/page_alloc.c @@ -1489,6 +1489,37 @@ unsigned int nr_free_pagecache_pages(voi return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER)); } +/* + * Amount of free+inactive RAM in a node. + */ +unsigned long nr_free_inactive_pages_node(int nid) +{ + enum zone_type i; + unsigned long sum = 0; + struct zone *zones = NODE_DATA(nid)->node_zones; + + for (i = 0; i < MAX_NR_ZONES; i++) + sum += zones[i].nr_inactive + + zones[i].free_pages - zones[i].pages_low; + + return sum; +} + +/* + * Accumulated scanned pages in a node. + */ +unsigned long nr_scanned_pages_node(int nid) +{ + enum zone_type i; + unsigned long sum = 0; + struct zone *zones = NODE_DATA(nid)->node_zones; + + for (i = 0; i < MAX_NR_ZONES; i++) + sum += zones[i].total_scanned; + + return sum; +} + static inline void show_node(struct zone *zone) { if (NUMA_BUILD) diff -puN mm/vmscan.c~readahead-state-based-method-aging-accounting mm/vmscan.c --- a/mm/vmscan.c~readahead-state-based-method-aging-accounting +++ a/mm/vmscan.c @@ -683,6 +683,7 @@ static unsigned long shrink_inactive_lis &page_list, &nr_scan); zone->nr_inactive -= nr_taken; zone->pages_scanned += nr_scan; + zone->total_scanned += nr_scan; spin_unlock_irq(&zone->lru_lock); nr_scanned += nr_scan; _ Patches currently in -mm which might be from wfg@xxxxxxxxxxxxxxxx are readahead-kconfig-options.patch radixtree-introduce-scan-hole-data-functions.patch mm-introduce-probe_page.patch mm-introduce-pg_readahead.patch readahead-add-look-ahead-support-to-__do_page_cache_readahead.patch readahead-insert-cond_resched-calls.patch readahead-minmax_ra_pages.patch readahead-events-accounting.patch readahead-rescue_pages.patch readahead-sysctl-parameters.patch readahead-min-max-sizes.patch readahead-state-based-method-aging-accounting.patch readahead-state-based-method-routines.patch readahead-state-based-method.patch readahead-context-based-method.patch readahead-initial-method-guiding-sizes.patch readahead-initial-method-thrashing-guard-size.patch readahead-initial-method-user-recommended-size.patch readahead-initial-method.patch readahead-backward-prefetching-method.patch readahead-thrashing-recovery-method.patch readahead-call-scheme.patch readahead-laptop-mode.patch readahead-loop-case.patch readahead-nfsd-case.patch readahead-turn-on-by-default.patch readahead-remove-size-limit-on-read_ahead_kb.patch readahead-remove-size-limit-of-max_sectors_kb-on-read_ahead_kb.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html