[RESEND PATCH 08/10] memblock: print memsize summary information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 )

Signed-off-by: Jaewon Kim <jaewon31.kim@xxxxxxxxxxx>
---
 mm/memblock.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/mm/memblock.c b/mm/memblock.c
index bb033c20ec43..0906d81f66c2 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2689,7 +2689,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);
@@ -2715,13 +2716,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;
 }
 
-- 
2.25.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux