]> Git Repo - linux.git/commitdiff
slub: add slab with one free object to partial list tail
authorShaohua Li <[email protected]>
Tue, 23 Aug 2011 00:36:59 +0000 (08:36 +0800)
committerPekka Enberg <[email protected]>
Sat, 27 Aug 2011 08:58:59 +0000 (11:58 +0300)
The slab has just one free object, adding it to partial list head doesn't make
sense. And it can cause lock contentation. For example,
1. CPU takes the slab from partial list
2. fetch an object
3. switch to another slab
4. free an object, then the slab is added to partial list again
In this way n->list_lock will be heavily contended.
In fact, Alex had a hackbench regression. 3.1-rc1 performance drops about 70%
against 3.0. This patch fixes it.

Acked-by: Christoph Lameter <[email protected]>
Reported-by: Alex Shi <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
mm/slub.c

index 9f662d70eb4772c041349d7febb0c74c571c6aa9..7c54fe83a90c509b543dbee8a1a7c11f844b9899 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2377,7 +2377,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page,
                 */
                if (unlikely(!prior)) {
                        remove_full(s, page);
-                       add_partial(n, page, 0);
+                       add_partial(n, page, 1);
                        stat(s, FREE_ADD_PARTIAL);
                }
        }
This page took 0.055192 seconds and 4 git commands to generate.