mm: memblock: add more debug logs
PATCH 1/1 mm: memblock: add more debug logs
Exact caller of memblock_phys_alloc_range is not available with "memblock=debug". Below information is not enough for memory accounting. for example:
[ 0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188
To enhance the memblock_dbg information or to get the exact owner of the memblock_reserve, add debug logs in memblock_phys_alloc_range function. After adding logs:
[ 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
--- mm/memblock.c | 3 +++ 1 file changed, 3 insertions(+)
mm/memblock.c +3 -0
@@ -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); }
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Mike Rapoport
maintainerHi,
Quoted 7 lines · Faiyaz Mohammed
Exact caller of
memblock_phys_alloc_rangeis not available with "memblock=debug". Below information is not enough for memory accounting. for example:[ 0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188To enhance the
memblock_dbginformation or to get the exact owner of thememblock_reserve, add debug logs inmemblock_phys_alloc_rangefunction.
Why would you want to use memblock=debug for memory accounting or for tracking of the owners of the reserved memory?
Quoted 27 lines
After adding logs:
[ 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/0x188Signed-off-by Faiyaz Mohammed <[email protected]>--- mm/memblock.c | 3 +++ 1 file changed, 3 insertions(+)mm/memblock.c +3
-0@@ -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); }Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
Sincerely yours, Mike.
Quoted 8 lines · Mike Rapoport
Hi,
Quoted 5 lines · Faiyaz Mohammed
Exact caller of
memblock_phys_alloc_rangeis not available with "memblock=debug". Below information is not enough for memory accounting. for example:[ 0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188
Quoted 4 lines
Quoted 2 lines
To enhance the
memblock_dbginformation or to get the exact owner of thememblock_reserve, add debug logs inmemblock_phys_alloc_rangefunction.Why would you want to use memblock=debug for memory accounting or for tracking of the owners of the reserved memory?
We do memblock reserved accounting to track owners to know size of memory
allocated by different drivers/owners through memblock_reserve, which help
in comparing different kernel version and in optimizations.
Quoted 28 lines
Quoted 28 lines
After adding logs:
[ 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/0x188Signed-off-by Faiyaz Mohammed <[email protected]>--- mm/memblock.c | 3 +++ 1 file changed, 3 insertions(+)mm/memblock.c +3
-0@@ -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); }Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Mike Rapoport
maintainerQuoted 10 lines · Faiyaz Mohammed
Quoted 8 lines · Mike Rapoport
Hi,
Quoted 5 lines · Faiyaz Mohammed
Exact caller of
memblock_phys_alloc_rangeis not available with "memblock=debug". Below information is not enough for memory accounting. for example:[ 0.000000] memblock_reserve: [0x000000023fc6b000-0x000000023fc6bfff] memblock_alloc_range_nid+0xc0/0x188
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
To enhance the
memblock_dbginformation or to get the exact owner of thememblock_reserve, add debug logs inmemblock_phys_alloc_rangefunction.Why would you want to use memblock=debug for memory accounting or for tracking of the owners of the reserved memory?
We do memblock reserved accounting to track owners to know size of memory allocated by different
drivers/ownersthroughmemblock_reserve, which help in comparing different kernel version and in optimizations.
I'd suggest to update the commit messaget to somthing like:
It is usefull to know the exact caller of memblock_phys_alloc_range() to track early memory reservations during developement.
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
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
After adding logs:
[ 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/0x188Signed-off-by Faiyaz Mohammed <[email protected]>--- mm/memblock.c | 3 +++ 1 file changed, 3 insertions(+)mm/memblock.c +3
-0@@ -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); }Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Signature · 2 lines
Sincerely yours, Mike.