ANDROID: memblock: print memsize summary information
With the previous patches, now we can print summary information.
Here's an example of 4GB DRAM device.
Reserved : 746924 KB
.kernel : 137027 KB
.unusable : 609897 KB
System : 3447380 KB
.common : 3152468 KB
.reusable : 294912 KB
Total : 4194304 KB ( 4096.00 MB )
Bug: 340432773
Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Link: https://lore.kernel.org/linux-mm/20240521023957.2587005-9-jaewon31.kim@samsung.com/
Change-Id: Ifb090c8c8b2ecc9668559bacbf22c42fa297e676
This commit is contained in:
committed by
Suren Baghdasaryan
parent
75fe456d4e
commit
2b02c9976f
+13
-1
@@ -2775,7 +2775,8 @@ static int memblock_memsize_show(struct seq_file *m, void *private)
|
||||
{
|
||||
int i;
|
||||
struct memsize_rgn_struct *rgn;
|
||||
unsigned long reserved = 0, reusable = 0;
|
||||
unsigned long reserved = 0, reusable = 0, total;
|
||||
unsigned long system = totalram_pages() << PAGE_SHIFT;
|
||||
|
||||
sort(memsize_rgn, memsize_rgn_count,
|
||||
sizeof(memsize_rgn[0]), memsize_rgn_cmp, NULL);
|
||||
@@ -2801,13 +2802,24 @@ static int memblock_memsize_show(struct seq_file *m, void *private)
|
||||
reserved += (unsigned long)rgn->size;
|
||||
}
|
||||
|
||||
total = memsize_kinit + reserved + system;
|
||||
|
||||
seq_puts(m, "\n");
|
||||
seq_printf(m, "Reserved : %7lu KB\n",
|
||||
DIV_ROUND_UP(memsize_kinit + reserved, SZ_1K));
|
||||
seq_printf(m, " .kernel : %7lu KB\n",
|
||||
DIV_ROUND_UP(memsize_kinit, SZ_1K));
|
||||
seq_printf(m, " .unusable : %7lu KB\n",
|
||||
DIV_ROUND_UP(reserved, SZ_1K));
|
||||
seq_printf(m, "System : %7lu KB\n",
|
||||
DIV_ROUND_UP(system, SZ_1K));
|
||||
seq_printf(m, " .common : %7lu KB\n",
|
||||
DIV_ROUND_UP(system - reusable, SZ_1K));
|
||||
seq_printf(m, " .reusable : %7lu KB\n",
|
||||
DIV_ROUND_UP(reusable, SZ_1K));
|
||||
seq_printf(m, "Total : %7lu KB ( %5lu.%02lu MB )\n",
|
||||
DIV_ROUND_UP(total, SZ_1K),
|
||||
total >> 20, ((total % SZ_1M) * 100) >> 20);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user