mm/slob: Use free_page instead of put_page for page-size kmalloc allocations
authorEzequiel Garcia <elezegarcia@gmail.com>
Mon, 22 Oct 2012 12:04:31 +0000 (09:04 -0300)
committerPekka Enberg <penberg@kernel.org>
Wed, 31 Oct 2012 06:53:54 +0000 (08:53 +0200)
When freeing objects, the slob allocator currently free empty pages
calling __free_pages(). However, page-size kmallocs are disposed
using put_page() instead.

It makes no sense to call put_page() for kernel pages that are provided
by the object allocator, so we shouldn't be doing this ourselves.

This is based on:
commit d9b7f22623b5fa9cc189581dcdfb2ac605933bf4
Author: Glauber Costa <glommer@parallels.com>
slub: use free_page instead of put_page for freeing kmalloc allocation

Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Matt Mackall <mpm@selenic.com>
Acked-by: Glauber Costa <glommer@parallels.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
mm/slob.c

index fffbc820774d88bcc00f66e88c5e43784f052e95..e7d790127e4b8aa72c43776f9575bd4aa5e27ed2 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -500,7 +500,7 @@ void kfree(const void *block)
                unsigned int *m = (unsigned int *)(block - align);
                slob_free(m, *m + align);
        } else
-               put_page(sp);
+               __free_pages(sp, compound_order(sp));
 }
 EXPORT_SYMBOL(kfree);