Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp829991ybv; Thu, 20 Feb 2020 08:03:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxx8WG/xSlZCxC3AKGtBpWwQ5+XfcwdmgaPL7gIHVoJXvTH7pWXJpIS821nHG0jOBGf4Sf8 X-Received: by 2002:a9d:12a8:: with SMTP id g37mr24333600otg.261.1582214600828; Thu, 20 Feb 2020 08:03:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582214600; cv=none; d=google.com; s=arc-20160816; b=Y+oZ3fX7eZlXSD2h1Jb9dCQLqorebV8YFSoXrcqFzNXe1F/iODTqfdZ6gUByWehr+t ELjKtxR81bZhvoXOyXIJo/+kQNyKh+kLFOmVveBXJWsSx4JbAmuhZUGZ90w6qzPiN0Ux 7kL+FVxCfjjSDKw9IRqLYs03fJYJ4P8XRjQtY5USdANhnq2wRphtOvLCyUQ4mI3m+NoJ vf2JyZvja7HnTcRfi3lc6hBnvSdtq5cjsxky0u+IFiZu+rVJxQL91tqvQNuu5/s2rGY4 rQp2ri57fALqsRRD8PKkYICZnhdKEdrLrvcln5dJjWRnonIU4t5dqH7WkKE4IDN1YvNu zSHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Gswwep3mXTBLLb6Vi32okBT2PfDu/kHkaO+Nde6OuPk=; b=QT/CKWJYVnFlx0cn2k8HxU+LPJrteBAIgz9M7qR4jT4bohJZ1kpU3vxxocLpUgKHa4 OGE/zJppQkaz46BsuMLVDmo35stPBagdSsFtoJtTGlg4VDE0CWo/IzEElK1bfNU4Fe8k 0/SLQ7LXB/Q/eTbyKMCaHrWP0gg2r9wz53a5tUhYfTjovHyPHSa4PoviTPv5sCVIxQgY nqqDi+DGC1yfVo354vX0yVJOvXO4kOkLFtZhIIBBRWh99SRXyFqbJCXgnPC9s6YHJ4WY tXmLILo/nyWFI1G0nXbgSSjGUT197Z197qJAvXuBq6DteHlVrWCQqkqZ5zfkjMVZWe+D XNtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=awDq0oJH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l9si1785181oti.229.2020.02.20.08.02.59; Thu, 20 Feb 2020 08:03:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=awDq0oJH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728695AbgBTQCd (ORCPT + 99 others); Thu, 20 Feb 2020 11:02:33 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:41966 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728644AbgBTQCc (ORCPT ); Thu, 20 Feb 2020 11:02:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582214551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gswwep3mXTBLLb6Vi32okBT2PfDu/kHkaO+Nde6OuPk=; b=awDq0oJHOyaMqOynjpx5exnDobC/emSja4lz/9H0caWoZFyGLwyW6y2XtKOIyCf+J4LE4a LkXDWH2LiVsDJUOzg7Jia2xKkfPg0vKYZ+64qHDvFQ3MXz7MPKD1PPQM/ITIm7LelBOU5p ihnUg9FOdN9HVLwDIFo0+4/BC/feuwM= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-79-lsHksNMyNQq3iOt2ip7N1A-1; Thu, 20 Feb 2020 11:02:30 -0500 X-MC-Unique: lsHksNMyNQq3iOt2ip7N1A-1 Received: by mail-qt1-f200.google.com with SMTP id y3so2892879qti.15 for ; Thu, 20 Feb 2020 08:02:30 -0800 (PST) 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=Gswwep3mXTBLLb6Vi32okBT2PfDu/kHkaO+Nde6OuPk=; b=JbiRIY75EATG5WGhqp0ypJLDqRm8gUiH0MHYFkoiNPVJ1vHEnI4uLNMl68Z+kQ2q2d Z2k5vV/JbZB96KEG767Mb/6n2Oe9LxTrD0JsiAnnRv5SGDEpC6UumLZw2qgbOaA/mdOg pXRC5cR/cpde4N+DlPXgjVmj9gjSh93iVYABZ6tEkGcP1fgBuVLkifOvk+uHkzQTDKsI F+uFACaDSvHeo1zn3SLO51GhsZx1swxDJjmnPi8Iw+in6rYjsiwGo3TIREVRR7eSS1nY exHHA32St6G+d3hIw82tFJ0F65BNkCm+cgFQc6dUqolaC3+qIli8uZxk9JK8TCWlZTFi BUYg== X-Gm-Message-State: APjAAAVJTLf4KqX0T1jKNRpeYY1xgQfh4Nfaup9HNSquyN+LJ2bjkjpX RWvxe/x6+gvzZ0rszVPK8RPKmRNE3wPeMrrpTBuhSR4sIowp8TE7BBKobS+7pW09MZ2rZF4UbnS EM3tL3db5zOX6ItAeAiKWXvEi X-Received: by 2002:a05:620a:20c1:: with SMTP id f1mr8514889qka.229.1582214549958; Thu, 20 Feb 2020 08:02:29 -0800 (PST) X-Received: by 2002:a05:620a:20c1:: with SMTP id f1mr8514853qka.229.1582214549733; Thu, 20 Feb 2020 08:02:29 -0800 (PST) Received: from xz-x1.redhat.com ([104.156.64.75]) by smtp.gmail.com with ESMTPSA id 89sm1957073qth.3.2020.02.20.08.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 08:02:28 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Peter Xu , Martin Cracauer , Mike Rapoport , Hugh Dickins , Jerome Glisse , "Kirill A . Shutemov" , Matthew Wilcox , Pavel Emelyanov , Brian Geffon , Maya Gokhale , Denis Plotnikov , Andrea Arcangeli , Johannes Weiner , "Dr . David Alan Gilbert" , Linus Torvalds , Mike Kravetz , Marty McFadden , David Hildenbrand , Bobby Powers , Mel Gorman Subject: [PATCH RESEND v6 08/16] sh/mm: Use helper fault_signal_pending() Date: Thu, 20 Feb 2020 11:02:26 -0500 Message-Id: <20200220160226.9550-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200220155353.8676-1-peterx@redhat.com> References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 5f51456f4fc7..eb4048ad0b38 100644 --- a/arch/sh/mm/fault.c +++ b/arch/sh/mm/fault.c @@ -302,25 +302,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(¤t->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(¤t->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(¤t->mm->mmap_sem); no_context(regs, error_code, address); return 1; } - up_read(¤t->mm->mmap_sem); /* * We ran out of memory, call the OOM killer, and return the -- 2.24.1