From: Peter Xu <pet...@redhat.com>

Let SH to use the new fault_signal_pending() helper.  Here we'll need to
move the up_read() out because that's actually needed as long as !RETRY
cases.  At the meantime we can drop all the rest of up_read()s now (which
seems to be cleaner).

Signed-off-by: Peter Xu <pet...@redhat.com>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Tested-by: Brian Geffon <bgef...@google.com>
Cc: Andrea Arcangeli <aarca...@redhat.com>
Cc: Bobby Powers <bobbypow...@gmail.com>
Cc: David Hildenbrand <da...@redhat.com>
Cc: Denis Plotnikov <dplotni...@virtuozzo.com>
Cc: "Dr . David Alan Gilbert" <dgilb...@redhat.com>
Cc: Hugh Dickins <hu...@google.com>
Cc: Jerome Glisse <jgli...@redhat.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: "Kirill A . Shutemov" <kir...@shutemov.name>
Cc: Martin Cracauer <craca...@cons.org>
Cc: Marty McFadden <mcfadd...@llnl.gov>
Cc: Matthew Wilcox <wi...@infradead.org>
Cc: Maya Gokhale <gokha...@llnl.gov>
Cc: Mel Gorman <mgor...@suse.de>
Cc: Mike Kravetz <mike.krav...@oracle.com>
Cc: Mike Rapoport <r...@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xe...@openvz.org>
Link: http://lkml.kernel.org/r/20200220160226.9550-1-pet...@redhat.com
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>

https://jira.sw.ru/browse/PSBM-102938
(cherry picked from commit fb027ada051a9e2d70a069b2aa62fb6f52100bbf)
Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com>
---
 arch/sh/mm/fault.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
index b8e7bb84b6b1..e1a257a83fb6 100644
--- a/arch/sh/mm/fault.c
+++ b/arch/sh/mm/fault.c
@@ -319,25 +319,25 @@ mm_fault_error(struct pt_regs *regs, unsigned long 
error_code,
         * Pagefault was interrupted by SIGKILL. We have no reason to
         * continue pagefault.
         */
-       if (fatal_signal_pending(current)) {
-               if (!(fault & VM_FAULT_RETRY))
-                       up_read(&current->mm->mmap_sem);
+       if (fault_signal_pending(fault, regs)) {
                if (!user_mode(regs))
                        no_context(regs, error_code, address);
                return 1;
        }
 
+       /* Release mmap_sem first if necessary */
+       if (!(fault & VM_FAULT_RETRY))
+               up_read(&current->mm->mmap_sem);
+
        if (!(fault & VM_FAULT_ERROR))
                return 0;
 
        if (fault & VM_FAULT_OOM) {
                /* Kernel mode? Handle exceptions or die: */
                if (!user_mode(regs)) {
-                       up_read(&current->mm->mmap_sem);
                        no_context(regs, error_code, address);
                        return 1;
                }
-               up_read(&current->mm->mmap_sem);
 
                /*
                 * We ran out of memory, call the OOM killer, and return the
-- 
2.25.3

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to