aboutsummaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2006-09-26 02:31:51 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:51 -0400
commit972d1a7b140569084439a81265a0f15b74e924e0 (patch)
treee86e676e407503ef3d98020a88bb925235f11434 /mm/slab.c
parent8417bba4b151346ed475fcc923693c9e3be89063 (diff)
[PATCH] ZVC: Support NR_SLAB_RECLAIMABLE / NR_SLAB_UNRECLAIMABLE
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>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 13b5050f84cc..7a48eb1a60c8 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -736,14 +736,6 @@ static DEFINE_MUTEX(cache_chain_mutex);
736static struct list_head cache_chain; 736static struct list_head cache_chain;
737 737
738/* 738/*
739 * vm_enough_memory() looks at this to determine how many slab-allocated pages
740 * are possibly freeable under pressure
741 *
742 * SLAB_RECLAIM_ACCOUNT turns this on per-slab
743 */
744atomic_t slab_reclaim_pages;
745
746/*
747 * chicken and egg problem: delay the per-cpu array allocation 739 * chicken and egg problem: delay the per-cpu array allocation
748 * until the general caches are up. 740 * until the general caches are up.
749 */ 741 */
@@ -1580,8 +1572,11 @@ static void *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, int nodeid)
1580 1572
1581 nr_pages = (1 << cachep->gfporder); 1573 nr_pages = (1 << cachep->gfporder);
1582 if (cachep->flags & SLAB_RECLAIM_ACCOUNT) 1574 if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1583 atomic_add(nr_pages, &slab_reclaim_pages); 1575 add_zone_page_state(page_zone(page),
1584 add_zone_page_state(page_zone(page), NR_SLAB, nr_pages); 1576 NR_SLAB_RECLAIMABLE, nr_pages);
1577 else
1578 add_zone_page_state(page_zone(page),
1579 NR_SLAB_UNRECLAIMABLE, nr_pages);
1585 for (i = 0; i < nr_pages; i++) 1580 for (i = 0; i < nr_pages; i++)
1586 __SetPageSlab(page + i); 1581 __SetPageSlab(page + i);
1587 return page_address(page); 1582 return page_address(page);
@@ -1596,7 +1591,12 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
1596 struct page *page = virt_to_page(addr); 1591 struct page *page = virt_to_page(addr);
1597 const unsigned long nr_freed = i; 1592 const unsigned long nr_freed = i;
1598 1593
1599 sub_zone_page_state(page_zone(page), NR_SLAB, nr_freed); 1594 if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1595 sub_zone_page_state(page_zone(page),
1596 NR_SLAB_RECLAIMABLE, nr_freed);
1597 else
1598 sub_zone_page_state(page_zone(page),
1599 NR_SLAB_UNRECLAIMABLE, nr_freed);
1600 while (i--) { 1600 while (i--) {
1601 BUG_ON(!PageSlab(page)); 1601 BUG_ON(!PageSlab(page));
1602 __ClearPageSlab(page); 1602 __ClearPageSlab(page);
@@ -1605,8 +1605,6 @@ static void kmem_freepages(struct kmem_cache *cachep, void *addr)
1605 if (current->reclaim_state) 1605 if (current->reclaim_state)
1606 current->reclaim_state->reclaimed_slab += nr_freed; 1606 current->reclaim_state->reclaimed_slab += nr_freed;
1607 free_pages((unsigned long)addr, cachep->gfporder); 1607 free_pages((unsigned long)addr, cachep->gfporder);
1608 if (cachep->flags & SLAB_RECLAIM_ACCOUNT)
1609 atomic_sub(1 << cachep->gfporder, &slab_reclaim_pages);
1610} 1608}
1611 1609
1612static void kmem_rcu_free(struct rcu_head *head) 1610static void kmem_rcu_free(struct rcu_head *head)