]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
[PATCH] ZVC: Support NR_SLAB_RECLAIMABLE / NR_SLAB_UNRECLAIMABLE
authorChristoph Lameter <clameter@sgi.com>
Tue, 26 Sep 2006 06:31:51 +0000 (23:31 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 26 Sep 2006 15:48:51 +0000 (08:48 -0700)
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@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
12 files changed:
arch/i386/mm/pgtable.c
drivers/base/node.c
fs/proc/proc_misc.c
include/linux/mmzone.h
include/linux/slab.h
mm/mmap.c
mm/nommu.c
mm/page_alloc.c
mm/slab.c
mm/slob.c
mm/vmscan.c
mm/vmstat.c

index bd98768d8764f52b0693a4413d32003bd911daed..a9f4910a22f8ca2587df09e1d8fded42d9b63d6e 100644 (file)
@@ -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));
 }
index e09f5c2c11eefb1f24358649035d1d0128d5158b..001e6f6b9c1bf085130f3f286b2a45d1116abf62 100644 (file)
@@ -68,7 +68,9 @@ static ssize_t node_read_meminfo(struct sys_device * dev, char * buf)
                       "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 sys_device * dev, char * buf)
                       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;
 }
index caa0a51560a03fe6d8599445543d5d3d72a70811..5bbd60896050545759f4aa603e12cfee9cd63295 100644 (file)
@@ -170,6 +170,8 @@ static int meminfo_read_proc(char *page, char **start, off_t off,
                "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, char **start, off_t off,
                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)),
index a703527e2b45297306c6756a27a374f942ab2ba6..08c41b9f92e0e8dc54621e1838be20564cd3c7ab 100644 (file)
@@ -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,
index 2f6bef6a98c9e01b03896d9326a9828b5dbd5fcb..66d6eb78d1c64e1f59691e37ae561f4c670d969b 100644 (file)
@@ -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 */
index 8507ee9cd573c3e99b859e910d76c6e397fe2cdd..eea8eefd51a86588bd1c091d94fe74df800a9bc2 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -116,7 +116,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
                 * 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
index c576df71e3bbd1b3f0527bb69b8d778daf20af9b..d99dea31e443f2505ce97b967c69681f2ae1e359 100644 (file)
@@ -1133,7 +1133,7 @@ int __vm_enough_memory(long pages, int cap_sys_admin)
                 * 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
index 5da6bc4e0a6b8a42268b00d61bd7e32ceb6eb7a9..47e98423b30dd6da8dea3e1bf03e8d7e3bf85cf0 100644 (file)
@@ -1304,7 +1304,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));
 
index 13b5050f84cce61121d6b163a57f306e38e27727..7a48eb1a60c834bf3a3b9698f43a82d8ebcae1e8 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -735,14 +735,6 @@ static inline void init_lock_keys(void)
 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_cache *cachep, gfp_t flags, int nodeid)
 
        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_cache *cachep, void *addr)
        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_cache *cachep, void *addr)
        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)
index 4c28a421b270e54170a6d36f62a4ab5c85d33107..20188627347c5dae1ae2575e1f036b6d9b03906f 100644 (file)
--- a/mm/slob.c
+++ b/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);
-
index 5154c25e844056b95c147c367dc9d01005dfcef5..349797ba4bac37fa476c5f33af8212afd33f3b3b 100644 (file)
@@ -1378,7 +1378,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
        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;
index 968c0072e19a17ef729fccc612427f44878b926f..490d8c1a0ded5efe731e6729136e3460341b3e5e 100644 (file)
@@ -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",