mm: memblock: add more debug logs
authorFaiyaz Mohammed <faiyazm@codeaurora.org>
Mon, 16 Nov 2020 04:44:04 +0000 (10:14 +0530)
committerMike Rapoport <rppt@linux.ibm.com>
Mon, 16 Nov 2020 07:32:39 +0000 (09:32 +0200)
It is useful to know the exact caller of memblock_phys_alloc_range() to
track early memory reservations during development.

Currently, when memblock debugging is enabled, the allocations done with
memblock_phys_alloc_range() are only reported at memblock_reserve():

[    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188

Add memblock_dbg() to memblock_phys_alloc_range() to get details about
its usage.

For example:

[    0.000000] memblock_phys_alloc_range: 4096 bytes align=0x1000 from=0x0000000000000000 max_addr=0x0000000000000000 early_pgtable_alloc+0x24/0x178
[    0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188

Signed-off-by: Faiyaz Mohammed <faiyazm@codeaurora.org>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
mm/memblock.c

index b68ee86788af91f2ed3646543eec78404a72d52e..db7a4f527abcb73f99670efe8043c7e74c7ccd2d 100644 (file)
@@ -1419,6 +1419,9 @@ phys_addr_t __init memblock_phys_alloc_range(phys_addr_t size,
                                             phys_addr_t start,
                                             phys_addr_t end)
 {
+       memblock_dbg("%s: %llu bytes align=0x%llx from=%pa max_addr=%pa %pS\n",
+                    __func__, (u64)size, (u64)align, &start, &end,
+                    (void *)_RET_IP_);
        return memblock_alloc_range_nid(size, align, start, end, NUMA_NO_NODE,
                                        false);
 }