]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm/memblock: add more comments in code
authorGrygorii Strashko <grygorii.strashko@ti.com>
Fri, 3 Jan 2014 03:09:53 +0000 (14:09 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 3 Jan 2014 03:09:53 +0000 (14:09 +1100)
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 <grygorii.strashko@ti.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memblock.c

index 9c58ff106d4515944b48ad347525b61623b00457..018e55dc004dda0c25a4948869096bbb5acab9fa 100644 (file)
@@ -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);