|
|
158ef88 |
From 3a83eda52f34b97168b70098ef0e34dbcaeaaf8f Mon Sep 17 00:00:00 2001
|
|
|
158ef88 |
From: Vishnu Pratap Singh <vishnu.ps@samsung.com>
|
|
|
158ef88 |
Date: Tue, 25 Aug 2015 00:04:44 +0000
|
|
|
158ef88 |
Subject: lib/show_mem.c: correct reserved memory calculation
|
|
|
158ef88 |
|
|
|
158ef88 |
CMA reserved memory is not part of total reserved memory.
|
|
|
158ef88 |
Currently when we print the total reserve memory it considers
|
|
|
158ef88 |
cma as part of reserve memory and do minus of totalcma_pages
|
|
|
158ef88 |
from reserved, which is wrong. In cases where total reserved
|
|
|
158ef88 |
is less than cma reserved we will get negative values & while
|
|
|
158ef88 |
printing we print as unsigned and we will get a very large value.
|
|
|
158ef88 |
|
|
|
158ef88 |
Below is the show mem output on X86 ubuntu based system where
|
|
|
158ef88 |
CMA reserved is 100MB (25600 pages) & total reserved is ~40MB(10316 pages).
|
|
|
158ef88 |
And reserve memory shows a large value because of this bug.
|
|
|
158ef88 |
|
|
|
158ef88 |
Before:
|
|
|
158ef88 |
[ 127.066430] 898908 pages RAM
|
|
|
158ef88 |
[ 127.066432] 671682 pages HighMem/MovableOnly
|
|
|
158ef88 |
[ 127.066434] 4294952012 pages reserved
|
|
|
158ef88 |
[ 127.066436] 25600 pages cma reserved
|
|
|
158ef88 |
|
|
|
158ef88 |
After:
|
|
|
158ef88 |
[ 44.663129] 898908 pages RAM
|
|
|
158ef88 |
[ 44.663130] 671682 pages HighMem/MovableOnly
|
|
|
158ef88 |
[ 44.663130] 10316 pages reserved
|
|
|
158ef88 |
[ 44.663131] 25600 pages cma reserved
|
|
|
158ef88 |
|
|
|
158ef88 |
Signed-off-by: Vishnu Pratap Singh <vishnu.ps@samsung.com>
|
|
|
158ef88 |
Cc: Michal Nazarewicz <mina86@mina86.com>
|
|
|
158ef88 |
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
|
|
|
158ef88 |
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
|
|
|
158ef88 |
Cc: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
|
|
|
158ef88 |
Cc: Sasha Levin <sasha.levin@oracle.com>
|
|
|
158ef88 |
Cc: Danesh Petigara <dpetigara@broadcom.com>
|
|
|
158ef88 |
Cc: Laura Abbott <lauraa@codeaurora.org>
|
|
|
158ef88 |
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
|
|
|
158ef88 |
---
|
|
|
158ef88 |
lib/show_mem.c | 4 +---
|
|
|
158ef88 |
1 file changed, 1 insertion(+), 3 deletions(-)
|
|
|
158ef88 |
|
|
|
158ef88 |
diff --git a/lib/show_mem.c b/lib/show_mem.c
|
|
|
158ef88 |
index adc98e18..1feed6a 100644
|
|
|
158ef88 |
--- a/lib/show_mem.c
|
|
|
158ef88 |
+++ b/lib/show_mem.c
|
|
|
158ef88 |
@@ -38,11 +38,9 @@ void show_mem(unsigned int filter)
|
|
|
158ef88 |
|
|
|
158ef88 |
printk("%lu pages RAM\n", total);
|
|
|
158ef88 |
printk("%lu pages HighMem/MovableOnly\n", highmem);
|
|
|
158ef88 |
+ printk("%lu pages reserved\n", reserved);
|
|
|
158ef88 |
#ifdef CONFIG_CMA
|
|
|
158ef88 |
- printk("%lu pages reserved\n", (reserved - totalcma_pages));
|
|
|
158ef88 |
printk("%lu pages cma reserved\n", totalcma_pages);
|
|
|
158ef88 |
-#else
|
|
|
158ef88 |
- printk("%lu pages reserved\n", reserved);
|
|
|
158ef88 |
#endif
|
|
|
158ef88 |
#ifdef CONFIG_QUICKLIST
|
|
|
158ef88 |
printk("%lu pages in pagetable cache\n",
|
|
|
158ef88 |
--
|
|
|
158ef88 |
cgit v0.11.2
|
|
|
158ef88 |
|