slub defrag: Transition patch upstream -> -next

From: Christoph Lameter
Date: Fri Jan 29 2010 - 15:51:17 EST


The slub statistics have been simplified through the use of per cpu
operations in -next. In order for this patchset to compile applied to the
-next tree the following changes need to be made.

Signed-off-by: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>


---
mm/slub.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)

Index: slab-2.6/mm/slub.c
===================================================================
--- slab-2.6.orig/mm/slub.c 2010-01-29 12:26:52.000000000 -0600
+++ slab-2.6/mm/slub.c 2010-01-29 12:28:28.000000000 -0600
@@ -2906,7 +2906,6 @@ static int kmem_cache_vacate(struct page
void *private;
unsigned long flags;
unsigned long objects;
- struct kmem_cache_cpu *c;

local_irq_save(flags);
slab_lock(page);
@@ -2955,13 +2954,12 @@ out:
* Check the result and unfreeze the slab
*/
leftover = page->inuse;
- c = get_cpu_slab(s, smp_processor_id());
if (leftover) {
/* Unsuccessful reclaim. Avoid future reclaim attempts. */
- stat(c, SHRINK_OBJECT_RECLAIM_FAILED);
+ stat(s, SHRINK_OBJECT_RECLAIM_FAILED);
__ClearPageSlubKickable(page);
} else
- stat(c, SHRINK_SLAB_RECLAIMED);
+ stat(s, SHRINK_SLAB_RECLAIMED);
unfreeze_slab(s, page, leftover > 0);
local_irq_restore(flags);
return leftover;
@@ -3012,14 +3010,12 @@ static unsigned long __kmem_cache_shrink
LIST_HEAD(zaplist);
int freed = 0;
struct kmem_cache_node *n = get_node(s, node);
- struct kmem_cache_cpu *c;

if (n->nr_partial <= limit)
return 0;

spin_lock_irqsave(&n->list_lock, flags);
- c = get_cpu_slab(s, smp_processor_id());
- stat(c, SHRINK_CALLS);
+ stat(s, SHRINK_CALLS);
list_for_each_entry_safe(page, page2, &n->partial, lru) {
if (!slab_trylock(page))
/* Busy slab. Get out of the way */
@@ -3039,14 +3035,14 @@ static unsigned long __kmem_cache_shrink

list_move(&page->lru, &zaplist);
if (s->kick) {
- stat(c, SHRINK_ATTEMPT_DEFRAG);
+ stat(s, SHRINK_ATTEMPT_DEFRAG);
n->nr_partial--;
__SetPageSlubFrozen(page);
}
slab_unlock(page);
} else {
/* Empty slab page */
- stat(c, SHRINK_EMPTY_SLAB);
+ stat(s, SHRINK_EMPTY_SLAB);
list_del(&page->lru);
n->nr_partial--;
slab_unlock(page);

--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/