From 5820cad0f65f514017b2bbad369062d54c73bd92 Mon Sep 17 00:00:00 2001 From: Grygorii Strashko Date: Fri, 3 Jan 2014 14:09:53 +1100 Subject: [PATCH] mm/memblock: add more comments in code Add additional description on: - why warning is produced in case if slab is ready - why kmemleak_alloc is called for each allocated memory block Signed-off-by: Grygorii Strashko Cc: Yinghai Lu Cc: Tejun Heo Signed-off-by: Andrew Morton --- mm/memblock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/memblock.c b/mm/memblock.c index 9c58ff106d45..018e55dc004d 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1071,6 +1071,11 @@ static void * __init memblock_virt_alloc_internal( pr_warn("%s: usage of MAX_NUMNODES is deprecated. Use NUMA_NO_NODE\n", __func__); + /* + * Detect any accidental use of these APIs after slab is ready, as at + * this moment memblock may be deinitialized already and its + * internal data may be destroyed (after execution of free_all_bootmem) + */ if (WARN_ON_ONCE(slab_is_available())) return kzalloc_node(size, GFP_NOWAIT, nid); @@ -1107,7 +1112,9 @@ done: /* * The min_count is set to 0 so that bootmem allocated blocks - * are never reported as leaks. + * are never reported as leaks. This is because many of these blocks + * are only referred via the physical address which is not + * looked up by kmemleak. */ kmemleak_alloc(ptr, size, 0, 0); -- 2.39.5