From: Grygorii Strashko Date: Fri, 3 Jan 2014 03:09:53 +0000 (+1100) Subject: mm/memblock: add more comments in code X-Git-Tag: next-20140106~2^2~193 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5820cad0f65f514017b2bbad369062d54c73bd92;p=karo-tx-linux.git 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 --- 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);