powerpc: Update page-in counter for CMM
authorBrian King <brking@linux.vnet.ibm.com>
Wed, 22 Oct 2008 05:53:45 +0000 (05:53 +0000)
committerPaul Mackerras <paulus@samba.org>
Wed, 5 Nov 2008 11:08:28 +0000 (22:08 +1100)
A new field has been added to the VPA as a method for the client OS to
communicate to firmware the number of page-ins it is performing when
running collaborative memory overcommit.  The hypervisor will use this
information to better determine if a partition is experiencing memory
pressure and needs more memory allocated to it.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/include/asm/lppaca.h
arch/powerpc/kernel/paca.c
arch/powerpc/mm/fault.c

index 2fe268b10333433ad6b2e40bcf2d90c392c45798..25aaa97facd821954a2a85a53fafe67497082e50 100644 (file)
@@ -133,7 +133,8 @@ struct lppaca {
 //=============================================================================
 // CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
 //=============================================================================
-       u8      pmc_save_area[256];     // PMC interrupt Area           x00-xFF
+       u32     page_ins;                       // CMO Hint - # page ins by OS  x00-x04
+       u8      pmc_save_area[252];     // PMC interrupt Area           x04-xFF
 } __attribute__((__aligned__(0x400)));
 
 extern struct lppaca lppaca[];
index 48a347133f41607c84a05e4b26647f17e4b6829c..c744b327bcabc866230198eda4dce37169ad0151 100644 (file)
@@ -37,6 +37,7 @@ struct lppaca lppaca[] = {
                .end_of_quantum = 0xfffffffffffffffful,
                .slb_count = 64,
                .vmxregs_in_use = 0,
+               .page_ins = 0,
        },
 };
 
index 565b7a237c847929e885eb5597fe4cdb14746cf3..b18bc0f023c8793adc5bc159f015e32042e2195f 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/kprobes.h>
 #include <linux/kdebug.h>
 
+#include <asm/firmware.h>
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
@@ -318,9 +319,16 @@ good_area:
                        goto do_sigbus;
                BUG();
        }
-       if (ret & VM_FAULT_MAJOR)
+       if (ret & VM_FAULT_MAJOR) {
                current->maj_flt++;
-       else
+#ifdef CONFIG_PPC_SMLPAR
+               if (firmware_has_feature(FW_FEATURE_CMO)) {
+                       preempt_disable();
+                       get_lppaca()->page_ins++;
+                       preempt_enable();
+               }
+#endif
+       } else
                current->min_flt++;
        up_read(&mm->mmap_sem);
        return 0;