From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <20070925233007.571098951@sgi.com> References: <20070925232543.036615409@sgi.com> Date: Tue, 25 Sep 2007 16:25:52 -0700 From: Christoph Lameter Subject: [patch 09/14] SLUB: Move count_partial() Content-Disposition: inline; filename=0002-slab_defrag_move_count_partial.patch Sender: owner-linux-mm@kvack.org Return-Path: To: akpm@linux-foundation.org Cc: linux-mm@kvack.org List-ID: Move the counting function for objects in partial slabs so that it is placed before kmem_cache_shrink. Signed-off-by: Christoph Lameter --- mm/slub.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) Index: linux-2.6.23-rc8-mm1/mm/slub.c =================================================================== --- linux-2.6.23-rc8-mm1.orig/mm/slub.c 2007-09-25 15:08:14.000000000 -0700 +++ linux-2.6.23-rc8-mm1/mm/slub.c 2007-09-25 15:23:52.000000000 -0700 @@ -2626,6 +2626,19 @@ void kfree(const void *x) } EXPORT_SYMBOL(kfree); +static unsigned long count_partial(struct kmem_cache_node *n) +{ + unsigned long flags; + unsigned long x = 0; + struct page *page; + + spin_lock_irqsave(&n->list_lock, flags); + list_for_each_entry(page, &n->partial, lru) + x += page->inuse; + spin_unlock_irqrestore(&n->list_lock, flags); + return x; +} + /* * kmem_cache_shrink removes empty slabs from the partial lists and sorts * the remaining slabs by the number of items in use. The slabs with the @@ -3372,19 +3385,6 @@ static int list_locations(struct kmem_ca return n; } -static unsigned long count_partial(struct kmem_cache_node *n) -{ - unsigned long flags; - unsigned long x = 0; - struct page *page; - - spin_lock_irqsave(&n->list_lock, flags); - list_for_each_entry(page, &n->partial, lru) - x += page->inuse; - spin_unlock_irqrestore(&n->list_lock, flags); - return x; -} - enum slab_stat_type { SL_FULL, SL_PARTIAL, -- -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org