* [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
@ 2011-11-22 18:31 Kautuk Consul
2011-11-26 23:50 ` Russell King - ARM Linux
0 siblings, 1 reply; 10+ messages in thread
From: Kautuk Consul @ 2011-11-22 18:31 UTC (permalink / raw)
To: Russell King, Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra
Cc: linux-arm-kernel, linux-kernel, Kautuk Consul
Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)
The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.
These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.
Port these changes to ARM.
Without these changes, my ARM board encounters many hang and livelock
scenarios.
After applying this patch, OOM feature performance improves according to
my testing.
Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
arch/arm/mm/fault.c | 58 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index aa33949..4aabeae 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -231,7 +231,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
static int __kprobes
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
- struct task_struct *tsk)
+ unsigned int flags, struct task_struct *tsk)
{
struct vm_area_struct *vma;
int fault;
@@ -253,18 +253,7 @@ good_area:
goto out;
}
- /*
- * If for any reason at all we couldn't handle the fault, make
- * sure we exit gracefully rather than endlessly redo the fault.
- */
- fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
- if (unlikely(fault & VM_FAULT_ERROR))
- return fault;
- if (fault & VM_FAULT_MAJOR)
- tsk->maj_flt++;
- else
- tsk->min_flt++;
- return fault;
+ return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
check_stack:
if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
@@ -279,6 +268,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
struct task_struct *tsk;
struct mm_struct *mm;
int fault, sig, code;
+ int write = fsr & FSR_WRITE;
+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
+ (write ? FAULT_FLAG_WRITE : 0);
if (notify_page_fault(regs, fsr))
return 0;
@@ -305,6 +297,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (!down_read_trylock(&mm->mmap_sem)) {
if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
goto no_context;
+retry:
down_read(&mm->mmap_sem);
} else {
/*
@@ -320,14 +313,41 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
#endif
}
- fault = __do_page_fault(mm, addr, fsr, tsk);
- up_read(&mm->mmap_sem);
+ fault = __do_page_fault(mm, addr, fsr, flags, tsk);
+
+ /* If we need to retry but a fatal signal is pending, handle the
+ * signal first. We do not need to release the mmap_sem because
+ * it would already be released in __lock_page_or_retry in
+ * mm/filemap.c. */
+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ return 0;
+
+ /*
+ * Major/minor page fault accounting is only done on the
+ * initial attempt. If we go through a retry, it is extremely
+ * likely that the page will be found in page cache at that point.
+ */
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
- if (fault & VM_FAULT_MAJOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr);
- else if (fault & VM_FAULT_MINOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, addr);
+ if (flags & FAULT_FLAG_ALLOW_RETRY) {
+ if (fault & VM_FAULT_MAJOR) {
+ tsk->maj_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
+ regs, addr);
+ } else {
+ tsk->min_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
+ regs, addr);
+ }
+ if (fault & VM_FAULT_RETRY) {
+ /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
+ * of starvation. */
+ flags &= ~FAULT_FLAG_ALLOW_RETRY;
+ goto retry;
+ }
+ }
+
+ up_read(&mm->mmap_sem);
/*
* Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
--
1.7.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-22 18:31 [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault Kautuk Consul
@ 2011-11-26 23:50 ` Russell King - ARM Linux
2011-11-27 5:58 ` Kautuk Consul
0 siblings, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-11-26 23:50 UTC (permalink / raw)
To: Kautuk Consul
Cc: Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra,
linux-arm-kernel, linux-kernel
On Tue, Nov 22, 2011 at 01:31:30PM -0500, Kautuk Consul wrote:
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
>
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
>
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
>
> Port these changes to ARM.
>
> Without these changes, my ARM board encounters many hang and livelock
> scenarios.
> After applying this patch, OOM feature performance improves according to
> my testing.
>
> Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
Thanks. I think this is fine. Please put it in the patch system so it's
not forgotten, and I'll get to it sometime during the next week. Thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-26 23:50 ` Russell King - ARM Linux
@ 2011-11-27 5:58 ` Kautuk Consul
2011-11-27 12:56 ` Will Deacon
0 siblings, 1 reply; 10+ messages in thread
From: Kautuk Consul @ 2011-11-27 5:58 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra,
linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 392 bytes --]
>
> Thanks. I think this is fine. Please put it in the patch system so it's
> not forgotten, and I'll get to it sometime during the next week. Thanks.
>
Thanks. I don't know what you mean by "put it in the patch system" as I already
did a "git send-email" for this patch to this mailing list.
So, please find the v5 patch file attached to this email for any
further reference.
[-- Attachment #2: 0001-arm-fault.c-Port-OOM-changes-into-do_page_fault.patch --]
[-- Type: text/x-patch, Size: 4261 bytes --]
From 9b7a0e6a271843246cfcc6a4dbb867d27f1868d1 Mon Sep 17 00:00:00 2001
From: Kautuk Consul <consul.kautuk@gmail.com>
Date: Tue, 22 Nov 2011 13:30:35 -0500
Subject: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)
The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.
These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.
Port these changes to ARM.
Without these changes, my ARM board encounters many hang and livelock
scenarios.
After applying this patch, OOM feature performance improves according to
my testing.
Signed-off-by: Kautuk Consul <consul.kautuk@gmail.com>
---
arch/arm/mm/fault.c | 58 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index aa33949..4aabeae 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -231,7 +231,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
static int __kprobes
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
- struct task_struct *tsk)
+ unsigned int flags, struct task_struct *tsk)
{
struct vm_area_struct *vma;
int fault;
@@ -253,18 +253,7 @@ good_area:
goto out;
}
- /*
- * If for any reason at all we couldn't handle the fault, make
- * sure we exit gracefully rather than endlessly redo the fault.
- */
- fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
- if (unlikely(fault & VM_FAULT_ERROR))
- return fault;
- if (fault & VM_FAULT_MAJOR)
- tsk->maj_flt++;
- else
- tsk->min_flt++;
- return fault;
+ return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
check_stack:
if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
@@ -279,6 +268,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
struct task_struct *tsk;
struct mm_struct *mm;
int fault, sig, code;
+ int write = fsr & FSR_WRITE;
+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
+ (write ? FAULT_FLAG_WRITE : 0);
if (notify_page_fault(regs, fsr))
return 0;
@@ -305,6 +297,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (!down_read_trylock(&mm->mmap_sem)) {
if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
goto no_context;
+retry:
down_read(&mm->mmap_sem);
} else {
/*
@@ -320,14 +313,41 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
#endif
}
- fault = __do_page_fault(mm, addr, fsr, tsk);
- up_read(&mm->mmap_sem);
+ fault = __do_page_fault(mm, addr, fsr, flags, tsk);
+
+ /* If we need to retry but a fatal signal is pending, handle the
+ * signal first. We do not need to release the mmap_sem because
+ * it would already be released in __lock_page_or_retry in
+ * mm/filemap.c. */
+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ return 0;
+
+ /*
+ * Major/minor page fault accounting is only done on the
+ * initial attempt. If we go through a retry, it is extremely
+ * likely that the page will be found in page cache at that point.
+ */
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
- if (fault & VM_FAULT_MAJOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr);
- else if (fault & VM_FAULT_MINOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, addr);
+ if (flags & FAULT_FLAG_ALLOW_RETRY) {
+ if (fault & VM_FAULT_MAJOR) {
+ tsk->maj_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
+ regs, addr);
+ } else {
+ tsk->min_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
+ regs, addr);
+ }
+ if (fault & VM_FAULT_RETRY) {
+ /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
+ * of starvation. */
+ flags &= ~FAULT_FLAG_ALLOW_RETRY;
+ goto retry;
+ }
+ }
+
+ up_read(&mm->mmap_sem);
/*
* Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
--
1.7.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-27 5:58 ` Kautuk Consul
@ 2011-11-27 12:56 ` Will Deacon
2011-12-01 7:40 ` Kautuk Consul
0 siblings, 1 reply; 10+ messages in thread
From: Will Deacon @ 2011-11-27 12:56 UTC (permalink / raw)
To: Kautuk Consul
Cc: Russell King - ARM Linux, Catalin Marinas, Ingo Molnar,
Peter Zijlstra, linux-arm-kernel, linux-kernel
On Sun, Nov 27, 2011 at 05:58:33AM +0000, Kautuk Consul wrote:
> >
> > Thanks. I think this is fine. Please put it in the patch system so it's
> > not forgotten, and I'll get to it sometime during the next week. Thanks.
> >
>
> Thanks. I don't know what you mean by "put it in the patch system" as I already
> did a "git send-email" for this patch to this mailing list.
>
> So, please find the v5 patch file attached to this email for any
> further reference.
You should read the documentation here:
http://www.arm.linux.org.uk/developer/patches/info.php
and then you can use git send-email --suppress-cc=all to email your patch to
the patch system, making sure you have the correct KernelVersion tag.
Will
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
@ 2011-11-22 18:16 Kautuk Consul
2011-11-22 18:33 ` kautuk.c @samsung.com
0 siblings, 1 reply; 10+ messages in thread
From: Kautuk Consul @ 2011-11-22 18:16 UTC (permalink / raw)
To: Russell King, Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra
Cc: linux-arm-kernel, linux-kernel
From: Kautuk <kautuk@ubuntu.(none)>
Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
(mm: retry page fault when blocking on disk transfer) and
commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
(x86,mm: make pagefault killable)
The above commits introduced changes into the x86 pagefault handler
for making the page fault handler retryable as well as killable.
These changes reduce the mmap_sem hold time, which is crucial
during OOM killer invocation.
Port these changes to ARM.
Without these changes, my ARM board encounters many hang and livelock
scenarios.
After applying this patch, OOM feature performance improves according to
my testing.
Signed-off-by: Kautuk <kautuk@ubuntu.(none)>
---
arch/arm/mm/fault.c | 58 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 19 deletions(-)
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index aa33949..4aabeae 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -231,7 +231,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
static int __kprobes
__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
- struct task_struct *tsk)
+ unsigned int flags, struct task_struct *tsk)
{
struct vm_area_struct *vma;
int fault;
@@ -253,18 +253,7 @@ good_area:
goto out;
}
- /*
- * If for any reason at all we couldn't handle the fault, make
- * sure we exit gracefully rather than endlessly redo the fault.
- */
- fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
- if (unlikely(fault & VM_FAULT_ERROR))
- return fault;
- if (fault & VM_FAULT_MAJOR)
- tsk->maj_flt++;
- else
- tsk->min_flt++;
- return fault;
+ return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
check_stack:
if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
@@ -279,6 +268,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
struct task_struct *tsk;
struct mm_struct *mm;
int fault, sig, code;
+ int write = fsr & FSR_WRITE;
+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
+ (write ? FAULT_FLAG_WRITE : 0);
if (notify_page_fault(regs, fsr))
return 0;
@@ -305,6 +297,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
if (!down_read_trylock(&mm->mmap_sem)) {
if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
goto no_context;
+retry:
down_read(&mm->mmap_sem);
} else {
/*
@@ -320,14 +313,41 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
#endif
}
- fault = __do_page_fault(mm, addr, fsr, tsk);
- up_read(&mm->mmap_sem);
+ fault = __do_page_fault(mm, addr, fsr, flags, tsk);
+
+ /* If we need to retry but a fatal signal is pending, handle the
+ * signal first. We do not need to release the mmap_sem because
+ * it would already be released in __lock_page_or_retry in
+ * mm/filemap.c. */
+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
+ return 0;
+
+ /*
+ * Major/minor page fault accounting is only done on the
+ * initial attempt. If we go through a retry, it is extremely
+ * likely that the page will be found in page cache at that point.
+ */
perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
- if (fault & VM_FAULT_MAJOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr);
- else if (fault & VM_FAULT_MINOR)
- perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, addr);
+ if (flags & FAULT_FLAG_ALLOW_RETRY) {
+ if (fault & VM_FAULT_MAJOR) {
+ tsk->maj_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
+ regs, addr);
+ } else {
+ tsk->min_flt++;
+ perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
+ regs, addr);
+ }
+ if (fault & VM_FAULT_RETRY) {
+ /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
+ * of starvation. */
+ flags &= ~FAULT_FLAG_ALLOW_RETRY;
+ goto retry;
+ }
+ }
+
+ up_read(&mm->mmap_sem);
/*
* Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
--
1.7.5.4
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-22 18:16 Kautuk Consul
@ 2011-11-22 18:33 ` kautuk.c @samsung.com
2011-11-22 19:17 ` Russell King - ARM Linux
0 siblings, 1 reply; 10+ messages in thread
From: kautuk.c @samsung.com @ 2011-11-22 18:33 UTC (permalink / raw)
To: Russell King, Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra
Cc: linux-arm-kernel, linux-kernel
Please disregard this one due to the following line :
From: Kautuk <kautuk@ubuntu.(none)>
There was something wrong in my git configuration.
On Tue, Nov 22, 2011 at 1:16 PM, Kautuk Consul <consul.kautuk@gmail.com> wrote:
> From: Kautuk <kautuk@ubuntu.(none)>
>
> Commit d065bd810b6deb67d4897a14bfe21f8eb526ba99
> (mm: retry page fault when blocking on disk transfer) and
> commit 37b23e0525d393d48a7d59f870b3bc061a30ccdb
> (x86,mm: make pagefault killable)
>
> The above commits introduced changes into the x86 pagefault handler
> for making the page fault handler retryable as well as killable.
>
> These changes reduce the mmap_sem hold time, which is crucial
> during OOM killer invocation.
>
> Port these changes to ARM.
>
> Without these changes, my ARM board encounters many hang and livelock
> scenarios.
> After applying this patch, OOM feature performance improves according to
> my testing.
>
> Signed-off-by: Kautuk <kautuk@ubuntu.(none)>
> ---
> arch/arm/mm/fault.c | 58 ++++++++++++++++++++++++++++++++++----------------
> 1 files changed, 39 insertions(+), 19 deletions(-)
>
> diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
> index aa33949..4aabeae 100644
> --- a/arch/arm/mm/fault.c
> +++ b/arch/arm/mm/fault.c
> @@ -231,7 +231,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma)
>
> static int __kprobes
> __do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
> - struct task_struct *tsk)
> + unsigned int flags, struct task_struct *tsk)
> {
> struct vm_area_struct *vma;
> int fault;
> @@ -253,18 +253,7 @@ good_area:
> goto out;
> }
>
> - /*
> - * If for any reason at all we couldn't handle the fault, make
> - * sure we exit gracefully rather than endlessly redo the fault.
> - */
> - fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, (fsr & FSR_WRITE) ? FAULT_FLAG_WRITE : 0);
> - if (unlikely(fault & VM_FAULT_ERROR))
> - return fault;
> - if (fault & VM_FAULT_MAJOR)
> - tsk->maj_flt++;
> - else
> - tsk->min_flt++;
> - return fault;
> + return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
>
> check_stack:
> if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
> @@ -279,6 +268,9 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
> struct task_struct *tsk;
> struct mm_struct *mm;
> int fault, sig, code;
> + int write = fsr & FSR_WRITE;
> + unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
> + (write ? FAULT_FLAG_WRITE : 0);
>
> if (notify_page_fault(regs, fsr))
> return 0;
> @@ -305,6 +297,7 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
> if (!down_read_trylock(&mm->mmap_sem)) {
> if (!user_mode(regs) && !search_exception_tables(regs->ARM_pc))
> goto no_context;
> +retry:
> down_read(&mm->mmap_sem);
> } else {
> /*
> @@ -320,14 +313,41 @@ do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
> #endif
> }
>
> - fault = __do_page_fault(mm, addr, fsr, tsk);
> - up_read(&mm->mmap_sem);
> + fault = __do_page_fault(mm, addr, fsr, flags, tsk);
> +
> + /* If we need to retry but a fatal signal is pending, handle the
> + * signal first. We do not need to release the mmap_sem because
> + * it would already be released in __lock_page_or_retry in
> + * mm/filemap.c. */
> + if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
> + return 0;
> +
> + /*
> + * Major/minor page fault accounting is only done on the
> + * initial attempt. If we go through a retry, it is extremely
> + * likely that the page will be found in page cache at that point.
> + */
>
> perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr);
> - if (fault & VM_FAULT_MAJOR)
> - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, regs, addr);
> - else if (fault & VM_FAULT_MINOR)
> - perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, regs, addr);
> + if (flags & FAULT_FLAG_ALLOW_RETRY) {
> + if (fault & VM_FAULT_MAJOR) {
> + tsk->maj_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1,
> + regs, addr);
> + } else {
> + tsk->min_flt++;
> + perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1,
> + regs, addr);
> + }
> + if (fault & VM_FAULT_RETRY) {
> + /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
> + * of starvation. */
> + flags &= ~FAULT_FLAG_ALLOW_RETRY;
> + goto retry;
> + }
> + }
> +
> + up_read(&mm->mmap_sem);
>
> /*
> * Handle the "normal" case first - VM_FAULT_MAJOR / VM_FAULT_MINOR
> --
> 1.7.5.4
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-22 18:33 ` kautuk.c @samsung.com
@ 2011-11-22 19:17 ` Russell King - ARM Linux
2011-11-23 3:23 ` kautuk.c @samsung.com
0 siblings, 1 reply; 10+ messages in thread
From: Russell King - ARM Linux @ 2011-11-22 19:17 UTC (permalink / raw)
To: kautuk.c @samsung.com
Cc: Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra,
linux-arm-kernel, linux-kernel
On Tue, Nov 22, 2011 at 01:33:42PM -0500, kautuk.c @samsung.com wrote:
> Please disregard this one due to the following line :
> From: Kautuk <kautuk@ubuntu.(none)>
>
> There was something wrong in my git configuration.
Which is the correct one? The first?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-22 19:17 ` Russell King - ARM Linux
@ 2011-11-23 3:23 ` kautuk.c @samsung.com
2011-11-23 3:36 ` kautuk.c @samsung.com
0 siblings, 1 reply; 10+ messages in thread
From: kautuk.c @samsung.com @ 2011-11-23 3:23 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra,
linux-arm-kernel, linux-kernel
Hi,
On Wed, Nov 23, 2011 at 12:47 AM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Tue, Nov 22, 2011 at 01:33:42PM -0500, kautuk.c @samsung.com wrote:
>> Please disregard this one due to the following line :
>> From: Kautuk <kautuk@ubuntu.(none)>
>>
>> There was something wrong in my git configuration.
>
> Which is the correct one? The first?
>
This one is correct, i.e., this email chain you have replied to.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault
2011-11-23 3:23 ` kautuk.c @samsung.com
@ 2011-11-23 3:36 ` kautuk.c @samsung.com
0 siblings, 0 replies; 10+ messages in thread
From: kautuk.c @samsung.com @ 2011-11-23 3:36 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Catalin Marinas, Will Deacon, Ingo Molnar, Peter Zijlstra,
linux-arm-kernel, linux-kernel
Sorry, this is actually the same email chain as the subject is the same.
Please review the second v5 patch not the first, i.e., the one without the
"From: Kautuk <kautuk@ubuntu.(none)>" line in it.
On Wed, Nov 23, 2011 at 8:53 AM, kautuk.c @samsung.com
<consul.kautuk@gmail.com> wrote:
> Hi,
>
> On Wed, Nov 23, 2011 at 12:47 AM, Russell King - ARM Linux
> <linux@arm.linux.org.uk> wrote:
>> On Tue, Nov 22, 2011 at 01:33:42PM -0500, kautuk.c @samsung.com wrote:
>>> Please disregard this one due to the following line :
>>> From: Kautuk <kautuk@ubuntu.(none)>
>>>
>>> There was something wrong in my git configuration.
>>
>> Which is the correct one? The first?
>>
>
> This one is correct, i.e., this email chain you have replied to.
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-12-01 7:40 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-22 18:31 [PATCH 1/1 v5] arm: fault.c: Port OOM changes into do_page_fault Kautuk Consul
2011-11-26 23:50 ` Russell King - ARM Linux
2011-11-27 5:58 ` Kautuk Consul
2011-11-27 12:56 ` Will Deacon
2011-12-01 7:40 ` Kautuk Consul
-- strict thread matches above, loose matches on Subject: below --
2011-11-22 18:16 Kautuk Consul
2011-11-22 18:33 ` kautuk.c @samsung.com
2011-11-22 19:17 ` Russell King - ARM Linux
2011-11-23 3:23 ` kautuk.c @samsung.com
2011-11-23 3:36 ` kautuk.c @samsung.com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®