[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200220160230.9598-1-peterx@redhat.com>
Date: Thu, 20 Feb 2020 11:02:30 -0500
From: Peter Xu <peterx@...hat.com>
To: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc: Peter Xu <peterx@...hat.com>, Martin Cracauer <cracauer@...s.org>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Hugh Dickins <hughd@...gle.com>,
Jerome Glisse <jglisse@...hat.com>,
"Kirill A . Shutemov" <kirill@...temov.name>,
Matthew Wilcox <willy@...radead.org>,
Pavel Emelyanov <xemul@...tuozzo.com>,
Brian Geffon <bgeffon@...gle.com>,
Maya Gokhale <gokhale2@...l.gov>,
Denis Plotnikov <dplotnikov@...tuozzo.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
"Dr . David Alan Gilbert" <dgilbert@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Marty McFadden <mcfadden8@...l.gov>,
David Hildenbrand <david@...hat.com>,
Bobby Powers <bobbypowers@...il.com>,
Mel Gorman <mgorman@...e.de>
Subject: [PATCH RESEND v6 09/16] mm: Return faster for non-fatal signals in user mode faults
The idea comes from the upstream discussion between Linus and Andrea:
https://lore.kernel.org/lkml/20171102193644.GB22686@redhat.com/
A summary to the issue: there was a special path in handle_userfault()
in the past that we'll return a VM_FAULT_NOPAGE when we detected
non-fatal signals when waiting for userfault handling. We did that by
reacquiring the mmap_sem before returning. However that brings a risk
in that the vmas might have changed when we retake the mmap_sem and
even we could be holding an invalid vma structure.
This patch is a preparation of removing that special path by allowing
the page fault to return even faster if we were interrupted by a
non-fatal signal during a user-mode page fault handling routine.
Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
Suggested-by: Andrea Arcangeli <aarcange@...hat.com>
Signed-off-by: Peter Xu <peterx@...hat.com>
---
include/linux/sched/signal.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h
index 4c87ffce64d1..09d40ce6a162 100644
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -379,7 +379,8 @@ static inline bool fault_signal_pending(unsigned int fault_flags,
struct pt_regs *regs)
{
return unlikely((fault_flags & VM_FAULT_RETRY) &&
- fatal_signal_pending(current));
+ (fatal_signal_pending(current) ||
+ (user_mode(regs) && signal_pending(current))));
}
/*
--
2.24.1
Powered by blists - more mailing lists