[RFC/PATCH 2/2] mm, slob: Save real allocated size in page->private

Ezequiel Garcia
2012-08-14T14:39:11Z

As documented in slob.c header, page->private field is used to return
accurately the allocated size, through ksize().
Therefore, if one allocates a contiguous set of pages the available size
is PAGE_SIZE << order, instead of the requested size.

Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Glauber Costa <glommer@parallels.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
mm/slob.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/slob.c b/mm/slob.c
index 686e98b..4c89b7d 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -459,7 +459,7 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
return NULL;

page = virt_to_page(ret);
- page->private = size;
+ page->private = PAGE_SIZE << order;

trace_kmalloc_node(_RET_IP_, ret,
size, PAGE_SIZE << order, gfp, node);
--
1.7.8.6