The patch titled ZVC: Support NR_SLAB_RECLAIMABLE / NR_SLAB_UNRECLAIMABLE has been added to the -mm tree. Its filename is zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: ZVC: Support NR_SLAB_RECLAIMABLE / NR_SLAB_UNRECLAIMABLE From: Christoph Lameter <clameter@xxxxxxx> Remove the atomic counter for slab_reclaim_pages and replace the counter and NR_SLAB with two ZVC counter that account for unreclaimable and reclaimable slab pages: NR_SLAB_RECLAIMABLE and NR_SLAB_UNRECLAIMABLE. Change the check in vmscan.c to refer to to NR_SLAB_RECLAIMABLE. The intend seems to be to check for slab pages that could be freed. Signed-off-by: Christoph Lameter <clameter@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/i386/mm/pgtable.c | 4 +++- drivers/base/node.c | 9 +++++++-- fs/proc/proc_misc.c | 7 ++++++- include/linux/mmzone.h | 3 ++- include/linux/slab.h | 2 -- mm/mmap.c | 2 +- mm/nommu.c | 2 +- mm/page_alloc.c | 3 ++- mm/slab.c | 24 +++++++++++------------- mm/slob.c | 4 ---- mm/vmscan.c | 2 +- mm/vmstat.c | 3 ++- 12 files changed, 36 insertions(+), 29 deletions(-) diff -puN arch/i386/mm/pgtable.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable arch/i386/mm/pgtable.c --- a/arch/i386/mm/pgtable.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/arch/i386/mm/pgtable.c @@ -60,7 +60,9 @@ void show_mem(void) printk(KERN_INFO "%lu pages writeback\n", global_page_state(NR_WRITEBACK)); printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED)); - printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB)); + printk(KERN_INFO "%lu pages slab\n", + global_page_state(NR_SLAB_RECLAIMABLE) + + global_page_state(NR_SLAB_UNRECLAIMABLE)); printk(KERN_INFO "%lu pages pagetables\n", global_page_state(NR_PAGETABLE)); } diff -puN drivers/base/node.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable drivers/base/node.c --- a/drivers/base/node.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/drivers/base/node.c @@ -68,7 +68,9 @@ static ssize_t node_read_meminfo(struct "Node %d PageTables: %8lu kB\n" "Node %d NFS_Unstable: %8lu kB\n" "Node %d Bounce: %8lu kB\n" - "Node %d Slab: %8lu kB\n", + "Node %d Slab: %8lu kB\n" + "Node %d SReclaimable: %8lu kB\n" + "Node %d SUnreclaim: %8lu kB\n", nid, K(i.totalram), nid, K(i.freeram), nid, K(i.totalram - i.freeram), @@ -88,7 +90,10 @@ static ssize_t node_read_meminfo(struct nid, K(node_page_state(nid, NR_PAGETABLE)), nid, K(node_page_state(nid, NR_UNSTABLE_NFS)), nid, K(node_page_state(nid, NR_BOUNCE)), - nid, K(node_page_state(nid, NR_SLAB))); + nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE) + + node_page_state(nid, NR_SLAB_UNRECLAIMABLE)), + nid, K(node_page_state(nid, NR_SLAB_RECLAIMABLE)), + nid, K(node_page_state(nid, NR_SLAB_UNRECLAIMABLE))); n += hugetlb_report_node_meminfo(nid, buf + n); return n; } diff -puN fs/proc/proc_misc.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable fs/proc/proc_misc.c --- a/fs/proc/proc_misc.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/fs/proc/proc_misc.c @@ -170,6 +170,8 @@ static int meminfo_read_proc(char *page, "AnonPages: %8lu kB\n" "Mapped: %8lu kB\n" "Slab: %8lu kB\n" + "SReclaimable: %8lu kB\n" + "SUnreclaim: %8lu kB\n" "PageTables: %8lu kB\n" "NFS_Unstable: %8lu kB\n" "Bounce: %8lu kB\n" @@ -197,7 +199,10 @@ static int meminfo_read_proc(char *page, K(global_page_state(NR_WRITEBACK)), K(global_page_state(NR_ANON_PAGES)), K(global_page_state(NR_FILE_MAPPED)), - K(global_page_state(NR_SLAB)), + K(global_page_state(NR_SLAB_RECLAIMABLE) + + global_page_state(NR_SLAB_UNRECLAIMABLE)), + K(global_page_state(NR_SLAB_RECLAIMABLE)), + K(global_page_state(NR_SLAB_UNRECLAIMABLE)), K(global_page_state(NR_PAGETABLE)), K(global_page_state(NR_UNSTABLE_NFS)), K(global_page_state(NR_BOUNCE)), diff -puN include/linux/mmzone.h~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable include/linux/mmzone.h --- a/include/linux/mmzone.h~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/include/linux/mmzone.h @@ -51,7 +51,8 @@ enum zone_stat_item { NR_FILE_MAPPED, /* pagecache pages mapped into pagetables. only modified from process context */ NR_FILE_PAGES, - NR_SLAB, /* Pages used by slab allocator */ + NR_SLAB_RECLAIMABLE, + NR_SLAB_UNRECLAIMABLE, NR_PAGETABLE, /* used for pagetables */ NR_FILE_DIRTY, NR_WRITEBACK, diff -puN include/linux/slab.h~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable include/linux/slab.h --- a/include/linux/slab.h~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/include/linux/slab.h @@ -284,8 +284,6 @@ extern kmem_cache_t *fs_cachep; extern kmem_cache_t *sighand_cachep; extern kmem_cache_t *bio_cachep; -extern atomic_t slab_reclaim_pages; - #endif /* __KERNEL__ */ #endif /* _LINUX_SLAB_H */ diff -puN mm/mmap.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/mmap.c --- a/mm/mmap.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/mmap.c @@ -112,7 +112,7 @@ int __vm_enough_memory(long pages, int c * which are reclaimable, under pressure. The dentry * cache and most inode caches should fall into this */ - free += atomic_read(&slab_reclaim_pages); + free += global_page_state(NR_SLAB_RECLAIMABLE); /* * Leave the last 3% for root diff -puN mm/nommu.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/nommu.c --- a/mm/nommu.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/nommu.c @@ -1133,7 +1133,7 @@ int __vm_enough_memory(long pages, int c * which are reclaimable, under pressure. The dentry * cache and most inode caches should fall into this */ - free += atomic_read(&slab_reclaim_pages); + free += global_page_state(NR_SLAB_RECLAIMABLE); /* * Leave the last 3% for root diff -puN mm/page_alloc.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/page_alloc.c --- a/mm/page_alloc.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/page_alloc.c @@ -1334,7 +1334,8 @@ void show_free_areas(void) global_page_state(NR_WRITEBACK), global_page_state(NR_UNSTABLE_NFS), nr_free_pages(), - global_page_state(NR_SLAB), + global_page_state(NR_SLAB_RECLAIMABLE) + + global_page_state(NR_SLAB_UNRECLAIMABLE), global_page_state(NR_FILE_MAPPED), global_page_state(NR_PAGETABLE)); diff -puN mm/slab.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/slab.c --- a/mm/slab.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/slab.c @@ -736,14 +736,6 @@ static DEFINE_MUTEX(cache_chain_mutex); static struct list_head cache_chain; /* - * vm_enough_memory() looks at this to determine how many slab-allocated pages - * are possibly freeable under pressure - * - * SLAB_RECLAIM_ACCOUNT turns this on per-slab - */ -atomic_t slab_reclaim_pages; - -/* * chicken and egg problem: delay the per-cpu array allocation * until the general caches are up. */ @@ -1580,8 +1572,11 @@ static void *kmem_getpages(struct kmem_c nr_pages = (1 << cachep->gfporder); if (cachep->flags & SLAB_RECLAIM_ACCOUNT) - atomic_add(nr_pages, &slab_reclaim_pages); - add_zone_page_state(page_zone(page), NR_SLAB, nr_pages); + add_zone_page_state(page_zone(page), + NR_SLAB_RECLAIMABLE, nr_pages); + else + add_zone_page_state(page_zone(page), + NR_SLAB_UNRECLAIMABLE, nr_pages); for (i = 0; i < nr_pages; i++) __SetPageSlab(page + i); return page_address(page); @@ -1596,7 +1591,12 @@ static void kmem_freepages(struct kmem_c struct page *page = virt_to_page(addr); const unsigned long nr_freed = i; - sub_zone_page_state(page_zone(page), NR_SLAB, nr_freed); + if (cachep->flags & SLAB_RECLAIM_ACCOUNT) + sub_zone_page_state(page_zone(page), + NR_SLAB_RECLAIMABLE, nr_freed); + else + sub_zone_page_state(page_zone(page), + NR_SLAB_UNRECLAIMABLE, nr_freed); while (i--) { BUG_ON(!PageSlab(page)); __ClearPageSlab(page); @@ -1605,8 +1605,6 @@ static void kmem_freepages(struct kmem_c if (current->reclaim_state) current->reclaim_state->reclaimed_slab += nr_freed; free_pages((unsigned long)addr, cachep->gfporder); - if (cachep->flags & SLAB_RECLAIM_ACCOUNT) - atomic_sub(1 << cachep->gfporder, &slab_reclaim_pages); } static void kmem_rcu_free(struct rcu_head *head) diff -puN mm/slob.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/slob.c --- a/mm/slob.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/slob.c @@ -339,7 +339,3 @@ void kmem_cache_init(void) mod_timer(&slob_timer, jiffies + HZ); } - -atomic_t slab_reclaim_pages = ATOMIC_INIT(0); -EXPORT_SYMBOL(slab_reclaim_pages); - diff -puN mm/vmscan.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/vmscan.c --- a/mm/vmscan.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/vmscan.c @@ -1378,7 +1378,7 @@ unsigned long shrink_all_memory(unsigned for_each_zone(zone) lru_pages += zone->nr_active + zone->nr_inactive; - nr_slab = global_page_state(NR_SLAB); + nr_slab = global_page_state(NR_SLAB_RECLAIMABLE); /* If slab caches are huge, it's better to hit them first */ while (nr_slab >= lru_pages) { reclaim_state.reclaimed_slab = 0; diff -puN mm/vmstat.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable mm/vmstat.c --- a/mm/vmstat.c~zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable +++ a/mm/vmstat.c @@ -458,7 +458,8 @@ static char *vmstat_text[] = { "nr_anon_pages", "nr_mapped", "nr_file_pages", - "nr_slab", + "nr_slab_reclaimable", + "nr_slab_unreclaimable", "nr_page_table_pages", "nr_dirty", "nr_writeback", _ Patches currently in -mm which might be from clameter@xxxxxxx are page-migration-replace-radix_tree_lookup_slot-with-radix_tree_lockup.patch reduce-max_nr_zones-remove-two-strange-uses-of-max_nr_zones.patch reduce-max_nr_zones-fix-max_nr_zones-array-initializations.patch reduce-max_nr_zones-make-display-of-highmem-counters-conditional-on-config_highmem.patch reduce-max_nr_zones-make-display-of-highmem-counters-conditional-on-config_highmem-tidy.patch reduce-max_nr_zones-move-highmem-counters-into-highmemc-h.patch reduce-max_nr_zones-move-highmem-counters-into-highmemc-h-fix.patch reduce-max_nr_zones-page-allocator-zone_highmem-cleanup.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment.patch reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup.patch reduce-max_nr_zones-make-zone_dma32-optional.patch reduce-max_nr_zones-make-zone_highmem-optional.patch reduce-max_nr_zones-make-zone_highmem-optional-fix.patch reduce-max_nr_zones-make-zone_highmem-optional-fix-fix.patch reduce-max_nr_zones-remove-display-of-counters-for-unconfigured-zones.patch reduce-max_nr_zones-fix-i386-srat-check-for-max_nr_zones.patch mempolicies-fix-policy_zone-check.patch apply-type-enum-zone_type.patch apply-type-enum-zone_type-fix.patch linearly-index-zone-node_zonelists.patch slab-respect-architecture-and-caller-mandated-alignment.patch slab-optimize-kmalloc_node-the-same-way-as-kmalloc.patch slab-optimize-kmalloc_node-the-same-way-as-kmalloc-fix.patch slab-extract-__kmem_cache_destroy-from-kmem_cache_destroy.patch slab-do-not-panic-when-alloc_kmemlist-fails-and-slab-is-up.patch add-__gfp_thisnode-to-avoid-fallback-to-other-nodes-and-ignore.patch add-__gfp_thisnode-to-avoid-fallback-to-other-nodes-and-ignore-fix.patch sys_move_pages-do-not-fall-back-to-other-nodes.patch guarantee-that-the-uncached-allocator-gets-pages-on-the-correct.patch cleanup-add-zone-pointer-to-get_page_from_freelist.patch profiling-require-buffer-allocation-on-the-correct-node.patch define-easier-to-handle-gfp_thisnode.patch optimize-free_one_page.patch do-not-check-unpopulated-zones-for-draining-and-counter.patch zvc-overstep-counters.patch zvc-scale-thresholds-depending-on-the-size-of-the-system.patch zvc-scale-thresholds-depending-on-the-size-of-the-system-fix.patch extract-the-allocpercpu-functions-from-the-slab-allocator.patch replace-min_unmapped_ratio-by-min_unmapped_pages-in-struct-zone.patch zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable.patch zone_reclaim-dynamic-slab-reclaim.patch x86-implement-always-locked-bit-ops-for-memory-shared-with-an-smp-hypervisor.patch zvc-support-nr_slab_reclaimable--nr_slab_unreclaimable-swap_prefetch.patch reduce-max_nr_zones-swap_prefetch-remove-incorrect-use-of-zone_highmem.patch readahead-state-based-method-aging-accounting-apply-type-enum-zone_type-readahead.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