From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DD8BC432C2 for ; Thu, 26 Sep 2019 09:40:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0D590222BE for ; Thu, 26 Sep 2019 09:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D590222BE 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 B21AB6B000E; Thu, 26 Sep 2019 05:40:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AD4A66B0010; Thu, 26 Sep 2019 05:40:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 99A466B0266; Thu, 26 Sep 2019 05:40:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id 7A8786B000E for ; Thu, 26 Sep 2019 05:40:02 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 27161180AD802 for ; Thu, 26 Sep 2019 09:40:02 +0000 (UTC) X-FDA: 75976575444.04.blood26_749b0a883a533 X-HE-Tag: blood26_749b0a883a533 X-Filterd-Recvd-Size: 4954 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 09:40:01 +0000 (UTC) Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (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 4846EC06512C for ; Thu, 26 Sep 2019 09:40:00 +0000 (UTC) Received: by mail-pl1-f200.google.com with SMTP id q5so1184245pls.0 for ; Thu, 26 Sep 2019 02:40:00 -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=Jbuek0IBtNMleGLem0b6G1JP1yfyDp1ywawNI2SggWk=; b=Mvm6kXKSXjQJhrl1P6xQoQxhZ/txOpfAboFmsPAuaWnBQdMUqgvOZKfqQzdeezpycx Dqo1LYnlX/HQ06N8z9lSn6uZaUoY9QXhfHg87OzwpV3isMCNHCSYtuN5L4KqYAZYqY7+ EuGNq+Z/lAidEGYzmb5jpi4e7OUnykhJuL1IUStXDE8GhgQfXI41O47jW3gYOf2yeOOh rnV1G3MAWguzVrH1lG7SJt4GSU3N8WCFe4uyEhr7UUK216vIYaYYJ9oFzdi3b6yxufAn 5K+ckRrAh2xIvSM5rZ6giiVQZXUHeRNjtMEJ9EgthjXGfrsRmvaCyWZmS6Ph8YkibZfp dC7g== X-Gm-Message-State: APjAAAUBHUNgVdgbn6jMbYuBPhK6ekd433Oxv+IbEM5dDbiIMcLTvKyB covhCzFmfJx3Jh2NKln1ksXzKwtcnZxNnDYU5I9Yq3SQ6I07Ts87iPUELWy5+nmT8G4rDVduVLk y/4RFS+AoAFs= X-Received: by 2002:a17:902:202:: with SMTP id 2mr3091346plc.96.1569490799214; Thu, 26 Sep 2019 02:39:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOsZ3BVghSeIFfGQEyW6lVgkhzRLJGhChjYo8ExyTTO9l78osOjDKhtCVViyXliYW7TRe8jw== X-Received: by 2002:a17:902:202:: with SMTP id 2mr3091314plc.96.1569490799031; Thu, 26 Sep 2019 02:39:59 -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.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Sep 2019 02:39:58 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand , Hugh Dickins , Maya Gokhale , Jerome Glisse , Pavel Emelyanov , Johannes Weiner , peterx@redhat.com, Martin Cracauer , Matthew Wilcox , Shaohua Li , Marty McFadden , Andrea Arcangeli , Mike Kravetz , Denis Plotnikov , Mike Rapoport , Linus Torvalds , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" Subject: [PATCH v5 05/16] arc/mm: Use helper fault_signal_pending() Date: Thu, 26 Sep 2019 17:38:53 +0800 Message-Id: <20190926093904.5090-6-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: Let ARC to use the new helper fault_signal_pending() by moving the signal check out of the retry logic as standalone. This should also helps to simplify the code a bit. Signed-off-by: Peter Xu --- arch/arc/mm/fault.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/arch/arc/mm/fault.c b/arch/arc/mm/fault.c index 3861543b66a0..ee3ba7c7b891 100644 --- a/arch/arc/mm/fault.c +++ b/arch/arc/mm/fault.c @@ -127,29 +127,21 @@ void do_page_fault(unsigned long address, struct pt= _regs *regs) =20 fault =3D handle_mm_fault(vma, address, flags); =20 + /* Quick path to respond to signals */ + if (fault_signal_pending(fault, regs)) { + if (!user_mode(regs)) + goto no_context; + return; + } + /* - * Fault retry nuances + * Fault retry nuances, mmap_sem already relinquished by core mm */ - if (unlikely(fault & VM_FAULT_RETRY)) { - - /* - * If fault needs to be retried, handle any pending signals - * first (by returning to user mode). - * mmap_sem already relinquished by core mm for RETRY case - */ - if (fatal_signal_pending(current)) { - if (!user_mode(regs)) - goto no_context; - return; - } - /* - * retry state machine - */ - if (flags & FAULT_FLAG_ALLOW_RETRY) { - flags &=3D ~FAULT_FLAG_ALLOW_RETRY; - flags |=3D FAULT_FLAG_TRIED; - goto retry; - } + if (unlikely((fault & VM_FAULT_RETRY) && + (flags & FAULT_FLAG_ALLOW_RETRY))) { + flags &=3D ~FAULT_FLAG_ALLOW_RETRY; + flags |=3D FAULT_FLAG_TRIED; + goto retry; } =20 bad_area: --=20 2.21.0