--- mm/slub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Index: linux-2.6/mm/slub.c =================================================================== --- linux-2.6.orig/mm/slub.c 2007-07-09 18:43:22.000000000 -0700 +++ linux-2.6/mm/slub.c 2007-07-09 18:46:08.000000000 -0700 @@ -2335,6 +2335,7 @@ int kmem_cache_shrink(struct kmem_cache struct page *t; struct list_head *slabs_by_inuse = kmalloc(sizeof(struct list_head) * s->objects, GFP_KERNEL); + int sort; unsigned long flags; if (!slabs_by_inuse) @@ -2358,6 +2359,7 @@ int kmem_cache_shrink(struct kmem_cache * Note that concurrent frees may occur while we hold the * list_lock. page->inuse here is the upper limit. */ + sort = n->nr_partial > MAX_PARTIAL; list_for_each_entry_safe(page, t, &n->partial, lru) { if (!page->inuse && slab_trylock(page)) { /* @@ -2370,13 +2372,13 @@ int kmem_cache_shrink(struct kmem_cache slab_unlock(page); discard_slab(s, page); } else { - if (n->nr_partial > MAX_PARTIAL) + if (sort) list_move(&page->lru, slabs_by_inuse + page->inuse); } } - if (n->nr_partial <= MAX_PARTIAL) + if (!sort) goto out; /*