From patchwork Thu Mar 24 07:01:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaewon Kim X-Patchwork-Id: 12790450 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2C06C433F5 for ; Thu, 24 Mar 2022 06:59:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94A9F8D0001; Thu, 24 Mar 2022 02:59:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83B678D0002; Thu, 24 Mar 2022 02:59:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 418636B007D; Thu, 24 Mar 2022 02:59:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 037A96B0083 for ; Thu, 24 Mar 2022 02:59:27 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id C94A160568 for ; Thu, 24 Mar 2022 06:59:26 +0000 (UTC) X-FDA: 79278378732.06.F86099D Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by imf07.hostedemail.com (Postfix) with ESMTP id 0EB1C40036 for ; Thu, 24 Mar 2022 06:59:25 +0000 (UTC) Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20220324065923epoutp01b88e8039d4652b22339aacdb417b62b7~fPuoid2cz3028930289epoutp01V for ; Thu, 24 Mar 2022 06:59:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20220324065923epoutp01b88e8039d4652b22339aacdb417b62b7~fPuoid2cz3028930289epoutp01V DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1648105164; bh=PwBzPZxuTryly8gTU/4JXZYuZ8XrDmft5OHgh415hkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F72tEsEKFQcFMguq+1/A44KVgP/ON+Rt1KswvLfmxSsm9W4PLFAeCCzVGxZtsIEpm cAgjg5M9eyDkiIg5z45axkDZIqa6lvf0ajztqKtEbM9JV7nEXc9dzD6YSgPZxS8Sfb Y/vBgG5I8t39XKMTESa6XxX9gT7c8gnRpVpmS3Oo= Received: from epsnrtp2.localdomain (unknown [182.195.42.163]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20220324065923epcas1p26fadde41347eda12b659c67ce636d567~fPuoPcYfB0342903429epcas1p2U; Thu, 24 Mar 2022 06:59:23 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.36.222]) by epsnrtp2.localdomain (Postfix) with ESMTP id 4KPGL213Fpz4x9QQ; Thu, 24 Mar 2022 06:59:22 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 52.2B.28648.7C61C326; Thu, 24 Mar 2022 15:59:19 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p4.samsung.com (KnoxPortal) with ESMTPA id 20220324065919epcas1p4b935c884aa3fde0917f6dff8bff128ed~fPukeTqKQ2463324633epcas1p4-; Thu, 24 Mar 2022 06:59:19 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220324065919epsmtrp2525e0b3bc0b06b141feab270e0fdde3d~fPukdoAAc2562225622epsmtrp2b; Thu, 24 Mar 2022 06:59:19 +0000 (GMT) X-AuditID: b6c32a39-ff1ff70000006fe8-8f-623c16c756f9 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id B8.AD.03370.7C61C326; Thu, 24 Mar 2022 15:59:19 +0900 (KST) Received: from jaewon-linux.10.32.193.11 (unknown [10.253.100.104]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220324065919epsmtip2fdb11aefb76992321248a719fdd451e8~fPukVfQeh3186531865epsmtip2f; Thu, 24 Mar 2022 06:59:19 +0000 (GMT) From: Jaewon Kim 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 Subject: [PATCH 7/8] memblock: print memsize summary information Date: Thu, 24 Mar 2022 16:01:57 +0900 Message-Id: <20220324070158.22969-8-jaewon31.kim@samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220324070158.22969-1-jaewon31.kim@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7bCmru5xMZskg+vdJhZz1q9hs+jePJPR ovf9KyaLy7vmsFncW/Of1eLI+u1MFrMb+xgtHq/nduDw2DnrLrvHplWdbB6bPk1i9zgx4zeL R9+WVYweZxYcYff4vEkugD0q2yYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEv MTfVVsnFJ0DXLTMH6CglhbLEnFKgUEBicbGSvp1NUX5pSapCRn5xia1SakFKToFZgV5xYm5x aV66Xl5qiZWhgYGRKVBhQnbGpUUPmQt+8lW87XnH2MB4kruLkZNDQsBEYufSA+xdjFwcQgI7 GCXmPjzNBOF8YpSYcOgVM4TzmVGi42crI0zL7xdroVp2MUrMvLGCDcL5wSgx+ccmZpAqNgFt ifcLJrGC2CICdhLfZh9gBSliFuhilHjw4SALSEJYwEFizYIzYGNZBFQlTv/oArN5BWwleiaf gFonL7F6wwGwoZxAg1YuOcAIMkhC4B67xLe/rawQRS4SGzumskPYwhKvjm+Bs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5BWwleiaf gNolL7F6wwFmEJtTwE5i5ZIDjBDLbCXOnjzANoGRbwEjwypGydSC4tz03GLDAqO81HK94sTc 4tK8dL3k/NxNjOCA1NLawbhn1Qe9Q4xMHIyHGCU4mJVEeO9ftk4S4k1JrKxKLcqPLyrNSS0+ xCjNwaIkznuh62S8kEB6YklqdmpqQWoRTJaJg1OqgYnZaNEJtsvbnfb5zxaP6gle+tspY5tW kzSTlv8ky1bZfHE5jb8nNeNPNjnvTlN6EdW9+JzJ8RDnhzMl7CQv14W/27dr6+w3v00Zckpe 3t7E0MjuyVexiENrkVjOCsO8x3/KNnBnsPOZnM5iin7BtLX4zqYQHX17g7/TNKTf3Sw+xvkw UfGhgeu/aCtjVpOri7gbtWTuOFQU3Z6nJ8bw4dD+nC3Ln5unFG1cxHTZjbf6J9t7hrl8M4Ss Enw8nkyd2teh2xoYqt2zsHblykTpz1M2fLC5rzut8dXyD9kBuxhXu5i5L/O/bVtmvPnuEYXH JTn3Xz5OzvrzI6Mouuje+2dLXnLr8UfUs6f+ZvHZo8RSnJFoqMVcVJwIACXlyq+3AgAA X-CMS-MailID: 20220324065919epcas1p4b935c884aa3fde0917f6dff8bff128ed X-Msg-Generator: CA X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20220324065919epcas1p4b935c884aa3fde0917f6dff8bff128ed References: <20220324070158.22969-1-jaewon31.kim@samsung.com> X-Rspam-User: X-Stat-Signature: mhmstudknr943b8w16f387dp1tzbb1nf Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=F72tEsEK; spf=pass (imf07.hostedemail.com: domain of jaewon31.kim@samsung.com designates 203.254.224.24 as permitted sender) smtp.mailfrom=jaewon31.kim@samsung.com; dmarc=pass (policy=none) header.from=samsung.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0EB1C40036 X-HE-Tag: 1648105165-976025 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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; }