From patchwork Wed Aug 14 10:41:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 171261 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp645599ily; Wed, 14 Aug 2019 03:41:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKFtdwMKLlbx0T2SkifmuRp5PF+ovp1ek4gOVg1g0wJdg6Q8cReCYOIjSz9Vs/oVmzPaT2 X-Received: by 2002:a17:902:7612:: with SMTP id k18mr41310550pll.48.1565779317268; Wed, 14 Aug 2019 03:41:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779317; cv=none; d=google.com; s=arc-20160816; b=lxi1HEJDsQeSjHSJ7jdDnl+vxHi48vZIgKl6GmLd7PaTHVci0pnp+RghPYnzDNcUo4 kZPH2Ei+7nWc+ZogrvhsCrKbRhxsLB7knAHi7cc1UI3MVla1aRRpEXLgGcqaK+OjlFy/ NH68hFqhmUyVQ9z7P3WwBq/BhiwTbx42wDy/raKvZhvjzbpfwqd6l4s3p4t0pURf6bGc 4iNdtphSnqItoINHeasyHPBiqlZM7R22u7Yg00dTKqtmcv+RKSlrISiD2IbRLGyrRh7M aEc7o1oo0gtYxM5cmh1YCx7IEhPGWmKdoVoNHJ4buBmRdKwB7rH6uJZMyDQE1tkH9UEm vTuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=JLRB1Xb2d8S6utCGsxi7rjJQZGK3NGMdrX1IsI11MQY=; b=L5BKrkyS+5krwL3BBEpmDtsVbkjNOOlFsjai/M87XFfo5E0cG4QXDkx15AanVvDZbC rKo50LwNloL/ADK2fzut/dBoww0GGoRwqdLRao/WZoznSiheGsVcZNWgS947WThuMlx/ vvTMXLq41elcvOcmFG3TZ23E3TkSZcKWpYC8r4Qg/KwO8FMsNCJ9zbyJu60DNnj580tO xsPjJk/TOvP1BsuAsbszLMGzuEEXzSv7lO/pAHWTJTyIw9TmGDj/D1ZQexPSPslW2wRH /Ss5K4tjLI6boShWc2p7uS4lF/WQocnj1CwY6QitmZbIOgHDhWjaSKdtnwwkvhzXW210 P8Sw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6si67659284pgg.489.2019.08.14.03.41.57; Wed, 14 Aug 2019 03:41:57 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727542AbfHNKl4 (ORCPT + 28 others); Wed, 14 Aug 2019 06:41:56 -0400 Received: from foss.arm.com ([217.140.110.172]:51958 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726821AbfHNKly (ORCPT ); Wed, 14 Aug 2019 06:41:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D5D3B1596; Wed, 14 Aug 2019 03:41:53 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0B51E3F706; Wed, 14 Aug 2019 03:41:51 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, akpm@linux-foundation.org, bigeasy@linutronix.de, bp@suse.de, catalin.marinas@arm.com, davem@davemloft.net, hch@lst.de, kan.liang@intel.com, mark.rutland@arm.com, mingo@kernel.org, peterz@infradead.org, riel@surriel.com, will@kernel.org Subject: [PATCH 6/9] sparc/perf: correctly check for kthreads Date: Wed, 14 Aug 2019 11:41:28 +0100 Message-Id: <20190814104131.20190-7-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190814104131.20190-1-mark.rutland@arm.com> References: <20190814104131.20190-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The sparc perf_callchain_user() functions looks at current->mm, apparently to determine whether the thread is a kthread without any valid user context. In general, a non-NULL current->mm doesn't imply that current is a kthread, as kthreads can install an mm via use_mm(), and so it's preferable to use is_kthread() to determine whether a thread is a kthread. For consistency, let's use is_kthread() here. Signed-off-by: Mark Rutland Cc: David S. Miller Cc: Ingo Molnar Cc: Peter Zijlstra --- arch/sparc/kernel/perf_event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 Acked-by: David S. Miller diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index a58ae9c42803..ef7b1a03bea9 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c @@ -1858,7 +1858,7 @@ perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs perf_callchain_store(entry, regs->tpc); - if (!current->mm) + if (is_kthread(current)) return; flushw_user();