From patchwork Wed Aug 14 10:41:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 171265 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp645859ily; Wed, 14 Aug 2019 03:42:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyxpeb6huR2WQESoYz0ne7XpgBRhJOvxZINNQS9oo9oYZIYGXsoZpMm4L5dXCrNt7xxy2iN X-Received: by 2002:a65:68c8:: with SMTP id k8mr37920459pgt.192.1565779331815; Wed, 14 Aug 2019 03:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565779331; cv=none; d=google.com; s=arc-20160816; b=m5o6QkhZjFKUfDV3b6a32K8DOQnVsr6Idw7RhIQIO1ZXMMd6ove81RmK6GsQm6BCNO n8MT/YZLjoofQwsYN0EGHMsxYhX+nZt9JKIezpKqIJNzHrAOE8WLKRGPK+Pi4yy1uqf/ KoYplIl7LHgKn6Qzgyy+MNxALzUu1+Rr0vjGDscqoz4nAe9i7LdQrou9+letPOYem315 +DST5aJyDncgg2KlFdCvsemz8zg81/zMZzqbRq/GB5Y3zkwsguZuTmmcgTWPkBGA9YVK bwMZGQ1JN2GvoTVHcmNbrff9FTdfC2f8UdwBhADHJZa7jwLB/0EhgPOeVnETA/5+sG90 9tsQ== 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=xuTQ86ouXiu31GwocfnnpFVIJAV43V3prL4/XODupWw=; b=YnydwKDsiNGoLhRenOlS1mzp3dhQ/mI1NUqF+6jeG4bltDO4M+Kae3f5WRqiVmQU+j l8rDQeBrkg5m6opPKrOJrEQpJp462ZZOggyHsznpcvhbxyebxzXzkfF7Gqpqqpx5kaNm CD+bBpE+NUTerKYPzRBK6GYavK2Yg3x6dfbCI87YC25nF0duCd/wpUSfr9oJCQAnooA2 /g36FYZyvqaapi9C4mFoXBOrFMAv4RoNnleaSmhD+rMqx2CKdnTYMuLPoCTBWzx+D/pY RfvV/YjVxvoUlNy6eobhwHyPLXO0pq1b4X5IT7J0r+CnKlY5QKff9GP4hoP7nnK0aA9E f/3A== 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 z14si62165051plo.104.2019.08.14.03.42.11; Wed, 14 Aug 2019 03:42:11 -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 S1727577AbfHNKl7 (ORCPT + 28 others); Wed, 14 Aug 2019 06:41:59 -0400 Received: from foss.arm.com ([217.140.110.172]:51934 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727456AbfHNKlv (ORCPT ); Wed, 14 Aug 2019 06:41:51 -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 648A1360; Wed, 14 Aug 2019 03:41:51 -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 8E2F63F706; Wed, 14 Aug 2019 03:41:49 -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 5/9] arm64: correctly check for ktrheads Date: Wed, 14 Aug 2019 11:41:27 +0100 Message-Id: <20190814104131.20190-6-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 Since commit: 6eb6c80187c55b7f ("arm64: kernel thread don't need to save fpsimd context.") ... we skip saving the fpsimd state for kernel threads in arch_dup_task_struct(). We determine whether current is a kthread by looking at current->mm. 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: Catalin Marinas Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Will Deacon --- arch/arm64/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.11.0 Acked-by: Catalin Marinas diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 288012687c29..82b0a7a257cd 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -335,7 +335,7 @@ void arch_release_task_struct(struct task_struct *tsk) */ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) { - if (current->mm) + if (!is_kthread(current)) fpsimd_preserve_current_state(); *dst = *src;