Skip to content

Commit 4090019

Browse files
bjking1paulusmack
authored andcommitted
powerpc: Update page-in counter for CMM
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 <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
1 parent 1ef8014 commit 4090019

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

arch/powerpc/include/asm/lppaca.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ struct lppaca {
133133
//=============================================================================
134134
// CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data
135135
//=============================================================================
136-
u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF
136+
u32 page_ins; // CMO Hint - # page ins by OS x00-x04
137+
u8 pmc_save_area[252]; // PMC interrupt Area x04-xFF
137138
} __attribute__((__aligned__(0x400)));
138139

139140
extern struct lppaca lppaca[];

arch/powerpc/kernel/paca.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct lppaca lppaca[] = {
3737
.end_of_quantum = 0xfffffffffffffffful,
3838
.slb_count = 64,
3939
.vmxregs_in_use = 0,
40+
.page_ins = 0,
4041
},
4142
};
4243

arch/powerpc/mm/fault.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <linux/kprobes.h>
3131
#include <linux/kdebug.h>
3232

33+
#include <asm/firmware.h>
3334
#include <asm/page.h>
3435
#include <asm/pgtable.h>
3536
#include <asm/mmu.h>
@@ -318,9 +319,16 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
318319
goto do_sigbus;
319320
BUG();
320321
}
321-
if (ret & VM_FAULT_MAJOR)
322+
if (ret & VM_FAULT_MAJOR) {
322323
current->maj_flt++;
323-
else
324+
#ifdef CONFIG_PPC_SMLPAR
325+
if (firmware_has_feature(FW_FEATURE_CMO)) {
326+
preempt_disable();
327+
get_lppaca()->page_ins++;
328+
preempt_enable();
329+
}
330+
#endif
331+
} else
324332
current->min_flt++;
325333
up_read(&mm->mmap_sem);
326334
return 0;

0 commit comments

Comments
 (0)