From: Jaewon Kim <jaewon31.kim@samsung.com>
To: rppt@kernel.org, vbabka@suse.cz, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
ytk.lee@samsung.com, jaewon31.kim@gmail.com,
Jaewon Kim <jaewon31.kim@samsung.com>
Subject: [PATCH 7/8] memblock: print memsize summary information
Date: Thu, 24 Mar 2022 16:01:57 +0900 [thread overview]
Message-ID: <20220324070158.22969-8-jaewon31.kim@samsung.com> (raw)
In-Reply-To: <20220324070158.22969-1-jaewon31.kim@samsung.com>
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@samsung.com>
---
mm/memblock.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 597ec7fb5bb2..ef8cec6242d2 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2492,7 +2492,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);
@@ -2518,13 +2519,24 @@ static int memblock_memsize_show(struct seq_file *m, void *private)
reserved += (unsigned long)rgn->size;
}
+ total = kernel_init_size + reserved + system;
+
seq_printf(m, "\n");
+ seq_printf(m, "Reserved : %7lu KB\n",
+ DIV_ROUND_UP(kernel_init_size + reserved, SZ_1K));
seq_printf(m, " .kernel : %7lu KB\n",
DIV_ROUND_UP(kernel_init_size, 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.17.1
next prev parent reply other threads:[~2022-03-24 6:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20220324065919epcas1p4c79da5f6ec4fa0311409ca24a38785d8@epcas1p4.samsung.com>
2022-03-24 7:01 ` [PATCH 0/8] memblock: introduce memsize showing reserved memory Jaewon Kim
[not found] ` <CGME20220324065919epcas1p35bafcd9151cf0469e4e933250c491a88@epcas1p3.samsung.com>
2022-03-24 7:01 ` [PATCH 1/8] " Jaewon Kim
[not found] ` <CGME20220324065919epcas1p1b30eabc8bbe01da1ef90280b6ee8bcea@epcas1p1.samsung.com>
2022-03-24 7:01 ` [PATCH 2/8] memblock: detect hidden memory hole size Jaewon Kim
[not found] ` <CGME20220324065919epcas1p3429ec2c9595c54ffe4ee25f273febd1c@epcas1p3.samsung.com>
2022-03-24 7:01 ` [PATCH 3/8] memblock: handle overlapped reserved memory region Jaewon Kim
[not found] ` <CGME20220324065919epcas1p256ff799f37a765a432475808e708d639@epcas1p2.samsung.com>
2022-03-24 7:01 ` [PATCH 4/8] memblock: track memblock changed at early param Jaewon Kim
[not found] ` <CGME20220324065919epcas1p3a3a267c4348be4fd3bb8437d4e6db142@epcas1p3.samsung.com>
2022-03-24 7:01 ` [PATCH 5/8] memblock: track kernel size on memsize Jaewon Kim
[not found] ` <CGME20220324065919epcas1p1058e2841b009d8c7d683bc0408f8a5a4@epcas1p1.samsung.com>
2022-03-24 7:01 ` [PATCH 6/8] memblock: recognize late free by checking PageReserved Jaewon Kim
[not found] ` <CGME20220324065919epcas1p4b935c884aa3fde0917f6dff8bff128ed@epcas1p4.samsung.com>
2022-03-24 7:01 ` Jaewon Kim [this message]
[not found] ` <CGME20220324065919epcas1p46b5381b1b839d7076673c23e8f9b0bba@epcas1p4.samsung.com>
2022-03-24 7:01 ` [PATCH 8/8] memblock: print kernel internal size Jaewon Kim
2022-03-25 7:46 ` [PATCH 0/8] memblock: introduce memsize showing reserved memory Mike Rapoport
[not found] ` <CGME20220324065919epcas1p4c79da5f6ec4fa0311409ca24a38785d8@epcms1p3>
2022-03-25 8:38 ` Jaewon Kim
2022-03-27 7:40 ` Mike Rapoport
[not found] ` <CGME20220324065919epcas1p4c79da5f6ec4fa0311409ca24a38785d8@epcms1p1>
2022-03-27 13:53 ` Jaewon Kim
2022-03-27 15:15 ` Mike Rapoport
[not found] ` <CGME20220324065919epcas1p4c79da5f6ec4fa0311409ca24a38785d8@epcms1p7>
2022-03-29 2:46 ` Jaewon Kim
2022-03-30 7:08 ` Mike Rapoport
[not found] ` <CGME20220324065919epcas1p4c79da5f6ec4fa0311409ca24a38785d8@epcms1p8>
2022-03-30 7:22 ` Jaewon Kim
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220324070158.22969-8-jaewon31.kim@samsung.com \
--to=jaewon31.kim@samsung.com \
--cc=akpm@linux-foundation.org \
--cc=jaewon31.kim@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@kernel.org \
--cc=vbabka@suse.cz \
--cc=ytk.lee@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).