Skip to contentSkip to conversation

arm: fault.c: correct how the tsk->[maj|min]_flt gets incremented

PATCH In review Kautuk Consul 1 participant 2 messages Mar 20, 2012 – Mar 25, 2012 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: fault.c: correct how the tsk->[maj|min]_flt gets incremented

commit 8878a539ff19a43cf3729e7562cd528f490246ae was done by me to make the page fault handler retryable as well as interruptible.

Due to this commit, there is a mistake in the way in which tsk->[maj|min]_flt counter gets incremented for VM_FAULT_ERROR:
If VM_FAULT_ERROR is returned in the fault flags by handle_mm_fault, then either maj_flt or min_flt will get incremented. This is wrong as in the case of a VM_FAULT_ERROR we need to be skip ahead to the error handling code in do_page_fault.

Added a check after the call to __do_page_fault() to check for (fault & VM_FAULT_ERROR).

---
 arch/arm/mm/fault.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mm/fault.c +1 -1
index bb7eac3..ec8c88b 100644
@@ -318,7 +318,7 @@ retry:
 	 */
 
 	perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
-	if (flags & FAULT_FLAG_ALLOW_RETRY) {
+	if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) {
 		if (fault & VM_FAULT_MAJOR) {
 			tsk->maj_flt++;
 			perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
Signature · 1 line
1.7.5.4
#1 lore raw

Hi,

did anyone get an opportunity to review this change ?

Quoted 34 lines · Kautuk Consul

commit 8878a539ff19a43cf3729e7562cd528f490246ae was done by me to make the page fault handler retryable as well as interruptible.

Due to this commit, there is a mistake in the way in which tsk->[maj|min]_flt counter gets incremented for VM_FAULT_ERROR:
If VM_FAULT_ERROR is returned in the fault flags by handle_mm_fault, then either maj_flt or min_flt will get incremented. This is wrong as in the case of a VM_FAULT_ERROR we need to be skip ahead to the error handling code in do_page_fault.

Added a check after the call to __do_page_fault() to check for (fault & VM_FAULT_ERROR).

---
?arch/arm/mm/fault.c | ? ?2 +-
?1 files changed, 1 insertions(+), 1 deletions(-)

arch/arm/mm/fault.c +0 -0
index bb7eac3..ec8c88b 100644
@@ -318,7 +318,7 @@ retry:

? ? ? ? */

? ? ? ?perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
- ? ? ? if (flags & FAULT_FLAG_ALLOW_RETRY) {
+ ? ? ? if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) { ? ? ? ? ? ? ? ?if (fault & VM_FAULT_MAJOR) {
? ? ? ? ? ? ? ? ? ? ? ?tsk->maj_flt++;
? ? ? ? ? ? ? ? ? ? ? ?perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, --
1.7.5.4