Commit 3da02648 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Michael Ellerman

powerpc/mm: Move CMO accounting out of do_page_fault into a helper

It makes do_page_fault() more readable. No functional change.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent b5c8f0fd
...@@ -222,6 +222,23 @@ static bool bad_kernel_fault(bool is_exec, unsigned long error_code, ...@@ -222,6 +222,23 @@ static bool bad_kernel_fault(bool is_exec, unsigned long error_code,
return is_exec || (address >= TASK_SIZE); return is_exec || (address >= TASK_SIZE);
} }
#ifdef CONFIG_PPC_SMLPAR
static inline void cmo_account_page_fault(void)
{
if (firmware_has_feature(FW_FEATURE_CMO)) {
u32 page_ins;
preempt_disable();
page_ins = be32_to_cpu(get_lppaca()->page_ins);
page_ins += 1 << PAGE_FACTOR;
get_lppaca()->page_ins = cpu_to_be32(page_ins);
preempt_enable();
}
}
#else
static inline void cmo_account_page_fault(void) { }
#endif /* CONFIG_PPC_SMLPAR */
/* /*
* Define the correct "is_write" bit in error_code based * Define the correct "is_write" bit in error_code based
* on the processor family * on the processor family
...@@ -501,17 +518,7 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address, ...@@ -501,17 +518,7 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
current->maj_flt++; current->maj_flt++;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
regs, address); regs, address);
#ifdef CONFIG_PPC_SMLPAR cmo_account_page_fault();
if (firmware_has_feature(FW_FEATURE_CMO)) {
u32 page_ins;
preempt_disable();
page_ins = be32_to_cpu(get_lppaca()->page_ins);
page_ins += 1 << PAGE_FACTOR;
get_lppaca()->page_ins = cpu_to_be32(page_ins);
preempt_enable();
}
#endif /* CONFIG_PPC_SMLPAR */
} else { } else {
current->min_flt++; current->min_flt++;
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment