Message ID | 20190926093904.5090-10-peterx@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=uin6=XV=kvack.org=owner-linux-mm@kernel.org> Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 929E476 for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 26 Sep 2019 09:40:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5FB19222BE for <patchwork-linux-mm@patchwork.kernel.org>; Thu, 26 Sep 2019 09:40:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FB19222BE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 99AAE6B0008; Thu, 26 Sep 2019 05:40:36 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 94B146B026A; Thu, 26 Sep 2019 05:40:36 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 861926B026B; Thu, 26 Sep 2019 05:40:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0203.hostedemail.com [216.40.44.203]) by kanga.kvack.org (Postfix) with ESMTP id 683D66B0008 for <linux-mm@kvack.org>; Thu, 26 Sep 2019 05:40:36 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id E91D5180AD802 for <linux-mm@kvack.org>; Thu, 26 Sep 2019 09:40:35 +0000 (UTC) X-FDA: 75976576830.15.books71_79936eb4b071b X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,peterx@redhat.com,::linux-kernel@vger.kernel.org:david@redhat.com:hughd@google.com:gokhale2@llnl.gov:jglisse@redhat.com:xemul@virtuozzo.com:hannes@cmpxchg.org:peterx@redhat.com:cracauer@cons.org:willy@infradead.org:shli@fb.com:mcfadden8@llnl.gov:aarcange@redhat.com:mike.kravetz@oracle.com:dplotnikov@virtuozzo.com:rppt@linux.vnet.ibm.com:torvalds@linux-foundation.org:mgorman@suse.de:kirill@shutemov.name:dgilbert@redhat.com,RULES_HIT:30051:30054,0,RBL:209.132.183.28:@redhat.com:.lbl8.mailshell.net-62.18.0.0 64.10.201.10,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: books71_79936eb4b071b X-Filterd-Recvd-Size: 4879 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf34.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Thu, 26 Sep 2019 09:40:35 +0000 (UTC) Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8A9217FDCA for <linux-mm@kvack.org>; Thu, 26 Sep 2019 09:40:34 +0000 (UTC) Received: by mail-pg1-f198.google.com with SMTP id f10so313073pgj.0 for <linux-mm@kvack.org>; Thu, 26 Sep 2019 02:40:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zs0icSpFo5EckbI9NuVzMV23UUzKD43r4J1NyJ/klic=; b=Et7L4qx3Q3mBOTxknJPg1ayxLrzHB464yMHvpEGYyWzSaUh7v80sWR7ckTu/orU5jw ZZcbRCGDWj+i6PpsF8+oL5p3QQ1cRHBiib2rpwyMzT35y0gQDqa7R0TxEP+Xn6vRcIsa nyd7f5C2ubB3egomg1Z2/xLs7qjz7GsVnd8+u0AFURdfyWgYb6IXOFgxLoLJ2mc8lwuB KxJx7aUS85g+8+ydVRfq9yX4HcS96TisuvQYoYcEdtmgg5cT7yLstjTv5XJZJ6KivWPt PUT2CBaDOPpatFcLNmgWJPWVI8aTNX+cJu3nCDZ06glPcLezjGYOTsvYF1C1gcFwCdw4 ZtyA== X-Gm-Message-State: APjAAAVzwDtEZ3UcrEaTueTAEbwo7V+z9lXw7IE+cCM/R4ztj7jbTaUf DiHW0eX8PoPI64UGqJxF/2k+Mqk0+DmedvLkZApNQQe4FuIZ34Ho7m+wQqXsqTJCwM6IjM4i7s2 kyscu8ckW4aY= X-Received: by 2002:a17:902:8488:: with SMTP id c8mr2742260plo.164.1569490833546; Thu, 26 Sep 2019 02:40:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy78qElHwxU+VN7yYhyu4WKCD5RFszqHAErQMKeM6BohEAgdvKCeLfzyvCTuMFSeTddGiEejA== X-Received: by 2002:a17:902:8488:: with SMTP id c8mr2742227plo.164.1569490833256; Thu, 26 Sep 2019 02:40:33 -0700 (PDT) Received: from xz-x1.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id p68sm3224982pfp.9.2019.09.26.02.40.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 02:40:32 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand <david@redhat.com>, Hugh Dickins <hughd@google.com>, Maya Gokhale <gokhale2@llnl.gov>, Jerome Glisse <jglisse@redhat.com>, Pavel Emelyanov <xemul@virtuozzo.com>, Johannes Weiner <hannes@cmpxchg.org>, peterx@redhat.com, Martin Cracauer <cracauer@cons.org>, Matthew Wilcox <willy@infradead.org>, Shaohua Li <shli@fb.com>, Marty McFadden <mcfadden8@llnl.gov>, Andrea Arcangeli <aarcange@redhat.com>, Mike Kravetz <mike.kravetz@oracle.com>, Denis Plotnikov <dplotnikov@virtuozzo.com>, Mike Rapoport <rppt@linux.vnet.ibm.com>, Linus Torvalds <torvalds@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, "Kirill A . Shutemov" <kirill@shutemov.name>, "Dr . David Alan Gilbert" <dgilbert@redhat.com> Subject: [PATCH v5 09/16] mm: Return faster for non-fatal signals in user mode faults Date: Thu, 26 Sep 2019 17:38:57 +0800 Message-Id: <20190926093904.5090-10-peterx@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190926093904.5090-1-peterx@redhat.com> References: <20190926093904.5090-1-peterx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
mm: Page fault enhancements
|
expand
|
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 46429192733b..031af0a6505a 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h @@ -387,7 +387,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)))); } /*
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@linux-foundation.org> Suggested-by: Andrea Arcangeli <aarcange@redhat.com> Signed-off-by: Peter Xu <peterx@redhat.com> --- include/linux/sched/signal.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)