[PATCH 0/8] memblock: introduce memsize showing reserved memory

Jaewon Kim
2022-03-24T06:59:52Z

Some of memory regions can be reserved for a specific purpose. They are
usually defined through reserved-memory in device tree. If only size
without address is specified in device tree, the address of the region
will be determined at boot time.

We may find the address of the memory regions through booting log, but
it does not show all. And it could be hard to catch the very beginning
log. The memblock_dump_all shows all memblock status but it does not
show region name and its information is difficult to summarize.

This patch introduce a debugfs node, memblock/memsize, to see reserved
memory easily.

Here's an example

$ cat debugfs/memblock/memsize
0x0f9000000-0x0fb000000 0x02000000 ( 32768 KB ) map reusable linux,cma
0x0b1900000-0x0b1b00000 0x00200000 ( 2048 KB ) nomap unusable test1
0x0b0200000-0x0b0400000 0x00200000 ( 2048 KB ) map unusable test2
(snipped)

Reserved : 746924 KB
.kernel : 137027 KB
.text : 28158 KB
.rwdata : 3238 KB
.rodata : 13468 KB
.bss : 12570 KB
.etc : 79593 KB
.unusable : 609897 KB
System : 3447380 KB
.common : 3152468 KB
.reusable : 294912 KB
Total : 4194304 KB ( 4096.00 MB )

Jaewon Kim (8):
memblock: introduce memsize showing reserved memory
memblock: detect hidden memory hole size
memblock: handle overlapped reserved memory region
memblock: track memblock changed at early param
memblock: track kernel size on memsize
memblock: recognize late free by checking PageReserved
memblock: print memsize summary information
memblock: print kernel internal size

drivers/of/fdt.c | 10 +
drivers/of/of_reserved_mem.c | 7 +-
include/linux/memblock.h | 21 ++
include/linux/mm.h | 3 +
init/main.c | 13 +-
kernel/dma/contiguous.c | 9 +-
mm/Kconfig | 7 +
mm/memblock.c | 434 ++++++++++++++++++++++++++++++++++-
mm/page_alloc.c | 15 +-
9 files changed, 506 insertions(+), 13 deletions(-)

--
2.17.1