* [PATCH] riscv/mm: Simplify retry logic in do_page_fault()
@ 2020-08-19 14:10 Pekka Enberg
2020-08-21 3:32 ` Palmer Dabbelt
0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2020-08-19 14:10 UTC (permalink / raw)
To: linux-riscv; +Cc: Pekka Enberg, palmer
From: Pekka Enberg <penberg@kernel.org>
Let's combine the two retry logic if statements in do_page_fault() to
simplify the code.
---
arch/riscv/mm/fault.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
index 716d64e36f83..f5c2e4a249eb 100644
--- a/arch/riscv/mm/fault.c
+++ b/arch/riscv/mm/fault.c
@@ -127,17 +127,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
BUG();
}
- if (flags & FAULT_FLAG_ALLOW_RETRY) {
- if (fault & VM_FAULT_RETRY) {
- flags |= FAULT_FLAG_TRIED;
-
- /*
- * No need to mmap_read_unlock(mm) as we would
- * have already released it in __lock_page_or_retry
- * in mm/filemap.c.
- */
- goto retry;
- }
+ if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
+ flags |= FAULT_FLAG_TRIED;
+
+ /*
+ * No need to mmap_read_unlock(mm) as we would
+ * have already released it in __lock_page_or_retry
+ * in mm/filemap.c.
+ */
+ goto retry;
}
mmap_read_unlock(mm);
--
2.26.2
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv/mm: Simplify retry logic in do_page_fault()
2020-08-19 14:10 [PATCH] riscv/mm: Simplify retry logic in do_page_fault() Pekka Enberg
@ 2020-08-21 3:32 ` Palmer Dabbelt
2020-08-21 4:06 ` Pekka Enberg
0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2020-08-21 3:32 UTC (permalink / raw)
To: penberg; +Cc: penberg, linux-riscv
On Wed, 19 Aug 2020 07:10:11 PDT (-0700), penberg@gmail.com wrote:
> From: Pekka Enberg <penberg@kernel.org>
>
> Let's combine the two retry logic if statements in do_page_fault() to
> simplify the code.
> ---
> arch/riscv/mm/fault.c | 20 +++++++++-----------
> 1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
> index 716d64e36f83..f5c2e4a249eb 100644
> --- a/arch/riscv/mm/fault.c
> +++ b/arch/riscv/mm/fault.c
> @@ -127,17 +127,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
> BUG();
> }
>
> - if (flags & FAULT_FLAG_ALLOW_RETRY) {
> - if (fault & VM_FAULT_RETRY) {
> - flags |= FAULT_FLAG_TRIED;
> -
> - /*
> - * No need to mmap_read_unlock(mm) as we would
> - * have already released it in __lock_page_or_retry
> - * in mm/filemap.c.
> - */
> - goto retry;
> - }
> + if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
> + flags |= FAULT_FLAG_TRIED;
> +
> + /*
> + * No need to mmap_read_unlock(mm) as we would
> + * have already released it in __lock_page_or_retry
> + * in mm/filemap.c.
> + */
> + goto retry;
> }
>
> mmap_read_unlock(mm);
This is missing your Signed-off-by, and while it's a bit pedantic I can't add
it myself. Otherwise
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Thanks!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv/mm: Simplify retry logic in do_page_fault()
2020-08-21 3:32 ` Palmer Dabbelt
@ 2020-08-21 4:06 ` Pekka Enberg
2020-08-21 19:25 ` Palmer Dabbelt
0 siblings, 1 reply; 4+ messages in thread
From: Pekka Enberg @ 2020-08-21 4:06 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: linux-riscv
On Fri, Aug 21, 2020 at 6:32 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Wed, 19 Aug 2020 07:10:11 PDT (-0700), penberg@gmail.com wrote:
> > From: Pekka Enberg <penberg@kernel.org>
> >
> > Let's combine the two retry logic if statements in do_page_fault() to
> > simplify the code.
> > ---
> > arch/riscv/mm/fault.c | 20 +++++++++-----------
> > 1 file changed, 9 insertions(+), 11 deletions(-)
> >
> > diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
> > index 716d64e36f83..f5c2e4a249eb 100644
> > --- a/arch/riscv/mm/fault.c
> > +++ b/arch/riscv/mm/fault.c
> > @@ -127,17 +127,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
> > BUG();
> > }
> >
> > - if (flags & FAULT_FLAG_ALLOW_RETRY) {
> > - if (fault & VM_FAULT_RETRY) {
> > - flags |= FAULT_FLAG_TRIED;
> > -
> > - /*
> > - * No need to mmap_read_unlock(mm) as we would
> > - * have already released it in __lock_page_or_retry
> > - * in mm/filemap.c.
> > - */
> > - goto retry;
> > - }
> > + if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
> > + flags |= FAULT_FLAG_TRIED;
> > +
> > + /*
> > + * No need to mmap_read_unlock(mm) as we would
> > + * have already released it in __lock_page_or_retry
> > + * in mm/filemap.c.
> > + */
> > + goto retry;
> > }
> >
> > mmap_read_unlock(mm);
>
> This is missing your Signed-off-by, and while it's a bit pedantic I can't add
> it myself. Otherwise
>
> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
>
> Thanks!
Oh, sorry about that. Here you go:
Signed-off-by: Pekka Enberg <penberg@kernel.org>
I can also resend the patch with a SOB if you so prefer.
- Pekka
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] riscv/mm: Simplify retry logic in do_page_fault()
2020-08-21 4:06 ` Pekka Enberg
@ 2020-08-21 19:25 ` Palmer Dabbelt
0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2020-08-21 19:25 UTC (permalink / raw)
To: penberg; +Cc: linux-riscv
On Thu, 20 Aug 2020 21:06:34 PDT (-0700), penberg@gmail.com wrote:
> On Fri, Aug 21, 2020 at 6:32 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>>
>> On Wed, 19 Aug 2020 07:10:11 PDT (-0700), penberg@gmail.com wrote:
>> > From: Pekka Enberg <penberg@kernel.org>
>> >
>> > Let's combine the two retry logic if statements in do_page_fault() to
>> > simplify the code.
>> > ---
>> > arch/riscv/mm/fault.c | 20 +++++++++-----------
>> > 1 file changed, 9 insertions(+), 11 deletions(-)
>> >
>> > diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c
>> > index 716d64e36f83..f5c2e4a249eb 100644
>> > --- a/arch/riscv/mm/fault.c
>> > +++ b/arch/riscv/mm/fault.c
>> > @@ -127,17 +127,15 @@ asmlinkage void do_page_fault(struct pt_regs *regs)
>> > BUG();
>> > }
>> >
>> > - if (flags & FAULT_FLAG_ALLOW_RETRY) {
>> > - if (fault & VM_FAULT_RETRY) {
>> > - flags |= FAULT_FLAG_TRIED;
>> > -
>> > - /*
>> > - * No need to mmap_read_unlock(mm) as we would
>> > - * have already released it in __lock_page_or_retry
>> > - * in mm/filemap.c.
>> > - */
>> > - goto retry;
>> > - }
>> > + if (unlikely((fault & VM_FAULT_RETRY) && (flags & FAULT_FLAG_ALLOW_RETRY))) {
>> > + flags |= FAULT_FLAG_TRIED;
>> > +
>> > + /*
>> > + * No need to mmap_read_unlock(mm) as we would
>> > + * have already released it in __lock_page_or_retry
>> > + * in mm/filemap.c.
>> > + */
>> > + goto retry;
>> > }
>> >
>> > mmap_read_unlock(mm);
>>
>> This is missing your Signed-off-by, and while it's a bit pedantic I can't add
>> it myself. Otherwise
>>
>> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
>>
>> Thanks!
>
> Oh, sorry about that. Here you go:
>
> Signed-off-by: Pekka Enberg <penberg@kernel.org>
>
> I can also resend the patch with a SOB if you so prefer.
This is fine. It's on fixes, but unless something comes up I won't send it out
until next week.
Thanks!
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-21 19:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 14:10 [PATCH] riscv/mm: Simplify retry logic in do_page_fault() Pekka Enberg
2020-08-21 3:32 ` Palmer Dabbelt
2020-08-21 4:06 ` Pekka Enberg
2020-08-21 19:25 ` Palmer Dabbelt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).