From: Jiang Liu <liuj97@gmail.com>
To: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
sworddragon2@aol.com
Cc: Jiang Liu <jiang.liu@huawei.com>,
bugzilla-daemon@bugzilla.kernel.org, linux-mm@kvack.org
Subject: [PATCH v2] mm: let /proc/meminfo report physical memory installed as "MemTotal"
Date: Thu, 21 Feb 2013 01:27:25 +0800 [thread overview]
Message-ID: <1361381245-14664-1-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1302191326150.6322@chino.kir.corp.google.com>
As reported by https://bugzilla.kernel.org/show_bug.cgi?id=53501,
"MemTotal" from /proc/meminfo means memory pages managed by the buddy
system (managed_pages), but "MemTotal" from /sys/.../node/nodex/meminfo
means phsical pages present (present_pages) within the NUMA node.
There's a difference between managed_pages and present_pages due to
bootmem allocator and reserved pages.
So change /proc/meminfo to report physical memory installed as
"MemTotal", which is
MemTotal = sum(pgdat->present_pages)
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Reported-by: sworddragon2@aol.com
---
Hi David,
How about this simpilified version?
Regards!
Gerry
---
mm/page_alloc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e4e8bf1..8e53d6e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2835,7 +2835,13 @@ static inline void show_node(struct zone *zone)
void si_meminfo(struct sysinfo *val)
{
- val->totalram = totalram_pages;
+ int nid;
+ unsigned long present_pages = 0;
+
+ for_each_node_state(nid, N_MEMORY)
+ present_pages += node_present_pages(nid);
+
+ val->totalram = present_pages;
val->sharedram = 0;
val->freeram = global_page_state(NR_FREE_PAGES);
val->bufferram = nr_blockdev_pages();
--
1.7.9.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2013-02-20 17:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-53501-27@https.bugzilla.kernel.org/>
2013-02-13 0:51 ` [Bug 53501] New: Duplicated MemTotal with different values Andrew Morton
2013-02-13 1:45 ` David Rientjes
2013-02-13 3:59 ` Andrew Morton
2013-02-14 3:19 ` David Rientjes
2013-02-14 4:01 ` Jiang Liu
2013-02-15 0:26 ` David Rientjes
2013-02-20 5:21 ` Simon Jeons
2013-02-20 7:09 ` David Rientjes
2013-03-02 2:21 ` Simon Jeons
2013-03-04 11:18 ` David Rientjes
2013-03-04 23:39 ` Simon Jeons
2013-03-05 21:53 ` David Rientjes
2013-02-16 16:27 ` [PATCH 1/2] vm: add 'MemManaged' field to /proc/meminfo and /sys/.../nodex/meminfo Jiang Liu
2013-02-19 21:29 ` David Rientjes
2013-02-20 17:27 ` Jiang Liu [this message]
2013-02-20 22:49 ` [PATCH v2] mm: let /proc/meminfo report physical memory installed as "MemTotal" Andrew Morton
2013-02-21 17:26 ` Jiang Liu
2013-02-21 21:31 ` Andrew Morton
2013-02-22 19:22 ` Jiang Liu
2013-02-16 16:27 ` [PATCH 2/2] mm: protect si_meminfo() and si_meminfo_node() from memory hotplug operations Jiang Liu
2013-02-19 21:32 ` David Rientjes
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=1361381245-14664-1-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bugzilla-daemon@bugzilla.kernel.org \
--cc=jiang.liu@huawei.com \
--cc=linux-mm@kvack.org \
--cc=rientjes@google.com \
--cc=sworddragon2@aol.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).