diff options
author | Shaohua Li <shaohua.li@intel.com> | 2011-08-22 20:36:59 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@kernel.org> | 2011-08-27 04:58:59 -0400 |
commit | 130655ef097940b627e8e04fa7c6f3b51cf24f85 (patch) | |
tree | c5b968196fe7f7ffcbe9def5dc70dc413a318dbd /mm/slub.c | |
parent | 81107188f123e3c2217ac2f2feb2a1147904c62f (diff) |
slub: add slab with one free object to partial list tail
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 <cl@linux.com>
Reported-by: Alex Shi <alex.shi@intel.com>
Signed-off-by: Shaohua Li <shli@kernel.org>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2377,7 +2377,7 @@ static void __slab_free(struct kmem_cache *s, struct page *page, | |||
2377 | */ | 2377 | */ |
2378 | if (unlikely(!prior)) { | 2378 | if (unlikely(!prior)) { |
2379 | remove_full(s, page); | 2379 | remove_full(s, page); |
2380 | add_partial(n, page, 0); | 2380 | add_partial(n, page, 1); |
2381 | stat(s, FREE_ADD_PARTIAL); | 2381 | stat(s, FREE_ADD_PARTIAL); |
2382 | } | 2382 | } |
2383 | } | 2383 | } |