Thread (6 messages) 6 messages, 4 authors, 2018-10-31

Re: [PATCH] powerpc/pseries: Export maximum memory value

From: Aravinda Prasad <hidden>
Date: 2018-10-16 07:36:22


On Wednesday 10 October 2018 10:19 PM, Naveen N. Rao wrote:
Nathan Fontenot wrote:
quoted
On 10/10/2018 05:22 AM, Aravinda Prasad wrote:
quoted
This patch exports the maximum possible amount of memory
configured on the system via /proc/powerpc/lparcfg.

Signed-off-by: Aravinda Prasad <redacted>
---
 arch/powerpc/platforms/pseries/lparcfg.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/arch/powerpc/platforms/pseries/lparcfg.c
b/arch/powerpc/platforms/pseries/lparcfg.c
index 7c872dc..aa82f55 100644
--- a/arch/powerpc/platforms/pseries/lparcfg.c
+++ b/arch/powerpc/platforms/pseries/lparcfg.c
@@ -26,6 +26,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/uaccess.h>
+#include <linux/hugetlb.h>
 #include <asm/lppaca.h>
 #include <asm/hvcall.h>
 #include <asm/firmware.h>
@@ -36,6 +37,7 @@
 #include <asm/vio.h>
 #include <asm/mmu.h>
 #include <asm/machdep.h>
+#include <asm/drmem.h>

 #include "pseries.h"
@@ -433,6 +435,16 @@ static void parse_em_data(struct seq_file *m)
         seq_printf(m, "power_mode_data=%016lx\n", retbuf[0]);
 }

+static void maxmem_data(struct seq_file *m)
+{
+    unsigned long maxmem = 0;
+
+    maxmem += drmem_info->n_lmbs * drmem_info->lmb_size;
+    maxmem += hugetlb_total_pages() * PAGE_SIZE;
+
+    seq_printf(m, "MaxMem=%ld\n", maxmem);
Should this be MaxPossibleMem?

At least for the drmem memory the value calculated is the maximum
possible
memory. I wonder if calling it MaxMem would lead users to think they have
that much memory available to them.
That's a good point. This seems to be referred to as just 'maximum
memory' in the LPAR configuration as well as in the lparstat
documentation, but it shouldn't hurt to rename it here.
As Naveen mentioned, I am using the term referred in the LPAR
configuration. But, I can rename it.

Regards,
Aravinda
- Naveen
-- 
Regards,
Aravinda
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help