riscv/mm: Simplify retry logic in do_page_fault()
PATCH 1/1 riscv/mm: Simplify retry logic in do_page_fault()
From: Pekka Enberg <[email protected]>
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(-)
arch/riscv/mm/fault.c +9 -11
@@ -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);
Signature · 7 lines
2.26.2 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 29 lines · On Wed, 19 Aug 2020 07:10:11 PDT (-0700), [email protected] wrote:
From: Pekka Enberg <[email protected]>
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(-)arch/riscv/mm/fault.c +2
-11@@ -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 ;
arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 141
Quoted 10 lines
arch/riscv/mm/fault.c +7
-0+ +/* +* 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
Thanks!
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Quoted 40 lines · Palmer Dabbelt
Quoted 38 lines · On Wed, 19 Aug 2020 07:10:11 PDT (-0700), [email protected] wrote:
From: Pekka Enberg <[email protected]>
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(-)arch/riscv/mm/fault.c +9
-11@@ -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; }
Quoted 8 lines
arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 141
Quoted 1 line
arch/riscv/mm/fault.c +0
-0mmap_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 <[email protected]>Thanks!
Oh, sorry about that. Here you go:
I can also resend the patch with a SOB if you so prefer.
- Pekka
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Palmer Dabbelt
maintainerQuoted 48 lines · On Thu, 20 Aug 2020 21:06:34 PDT (-0700), [email protected] wrote:
Quoted 47 lines · Palmer Dabbelt
Quoted 29 lines · On Wed, 19 Aug 2020 07:10:11 PDT (-0700), [email protected] wrote:
From: Pekka Enberg <[email protected]>
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(-)arch/riscv/mm/fault.c +2
-11@@ -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 ;arch/riscv/mm/fault.c asmlinkage void do_page_fault(struct pt_regs *regs) · line 141
Quoted 10 lines
arch/riscv/mm/fault.c +7
-0+ +/* +* 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 <[email protected]>
Quoted 7 lines
Quoted 1 line
Thanks!
Oh, sorry about that. Here you go:
Signed-off-by Pekka Enberg <[email protected]>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
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv