[PATCH] slab: reduce fragmentation due to kmem_cache_alloc_node
Attached is a patch that fixes the fragmentation that Badri noticed with kmem_cache_alloc_node. kmem_cache_alloc_node tries to allocate memory from a given node. The current implementation contains two bugs: - the node aware code was used even for !CONFIG_NUMA systems. Fix: inline function that redefines kmem_cache_alloc_node as kmem_cache_alloc for !CONFIG_NUMA. - the code always allocated a new slab for each new allocation. This caused severe fragmentation. Fix: walk the slabp lists and search for a matching page instead of allocating a new page. - the patch also adds a new statistics field for node-local allocs. They should be rare - the codepath is quite slow, especially compared to the normal kmem_cache_alloc. Signed-Off-By: Manfred Spraul <manfred@colorfullife.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing
Please register or sign in to comment