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@xxxxxxxxxx> Reported-by: sworddragon2@xxxxxxx --- 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@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>