]> git.baikalelectronics.ru Git - kernel.git/commit
SLUB: Free slabs and sort partial slab lists in kmem_cache_shrink
authorChristoph Lameter <clameter@sgi.com>
Sun, 6 May 2007 21:49:46 +0000 (14:49 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Mon, 7 May 2007 19:12:54 +0000 (12:12 -0700)
commit4e2894105ad87be7d45273f1e92edd13df5eb139
tree7c07b8319f80119066d9dbd0c1a0910c94a1259c
parent411b078816580e144f99f0749917ae8a700b4f44
SLUB: Free slabs and sort partial slab lists in kmem_cache_shrink

At kmem_cache_shrink check if we have any empty slabs on the partial
if so then remove them.

Also--as an anti-fragmentation measure--sort the partial slabs so that
the most fully allocated ones come first and the least allocated last.

The next allocations may fill up the nearly full slabs. Having the
least allocated slabs last gives them the maximum chance that their
remaining objects may be freed. Thus we can hopefully minimize the
partial slabs.

I think this is the best one can do in terms antifragmentation
measures. Real defragmentation (meaning moving objects out of slabs with
the least free objects to those that are almost full) can be implemted
by reverse scanning through the list produced here but that would mean
that we need to provide a callback at slab cache creation that allows
the deletion or moving of an object. This will involve slab API
changes, so defer for now.

Cc: Mel Gorman <mel@skynet.ie>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slub.c