Skip to content

Commit

Permalink
slub: add slab with one free object to partial list tail
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Shaohua Li authored and penberg committed Aug 27, 2011
1 parent 8110718 commit 130655e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 130655e

Please sign in to comment.