From 7b5c8878ce73ddd2ea6e5b1442a5d9da533e86fb Mon Sep 17 00:00:00 2001 From: Faiyaz Mohammed Date: Wed, 9 Oct 2019 11:38:35 +0530 Subject: [PATCH] mm: memblock: Add more debug logs memblock_alloc is not giving information of owner of the memblock_reserve, when we pass through command line "memblock=debug". Below information is not enough for memory statistics. for example: [ 0.000000] memblock_reserve: [0x000000013fbf8000-0x000000013fbf8fff] memblock_alloc+0x50/0x60. To enhance the memblokc_dbg information or to get the exact owner of the memblock_reserve added debug logs in different memblock alloc functions, which is helpful for memory statistics. After adding logs: [ 0.000000] memblock_alloc: size: 4096 align: 4096 early_pgtable_alloc+0x18/0x98. [ 0.000000] memblock_reserve: [0x000000013fbf9000-0x000000013fbf9fff] memblock_alloc+0x50/0x60. Change-Id: Ibc9603f71fe3150af67398658d04c34f824b47e1 Signed-off-by: Faiyaz Mohammed --- include/linux/memblock.h | 3 +++ mm/memblock.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 4fd77c758c27..f1ca5eeb1cfe 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -367,6 +367,9 @@ void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, static inline void * __init memblock_alloc(phys_addr_t size, phys_addr_t align) { + + memblock_dbg("%s: %llu bytes align=0x%llx %pS\n", + __func__, (u64)size, (u64)align, (void *)_RET_IP_); return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); } diff --git a/mm/memblock.c b/mm/memblock.c index 1adcca3cf4b5..2b94c94cf97a 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1413,6 +1413,10 @@ 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); }