From patchwork Thu Apr 19 10:58:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 133751 Delivered-To: patch@linaro.org Received: by 10.46.66.142 with SMTP id h14csp491070ljf; Thu, 19 Apr 2018 04:00:07 -0700 (PDT) X-Google-Smtp-Source: AIpwx49zjutWatVuob1qjbwSnp7mYZCD3yHjTBTauXNSHC9oAgqK8o+dMdQTJAIgdUI297eVc0z8 X-Received: by 10.98.46.5 with SMTP id u5mr5346297pfu.247.1524135607076; Thu, 19 Apr 2018 04:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524135607; cv=none; d=google.com; s=arc-20160816; b=QTx7SX3uPm0QgiQvQFQ2AP6BU9VL0Xyc3Gdr8c0/Nlsy9QTixed/Yzdgm7VWwZMA+r JRUGWmRIkQEw/+AFtZW87BDsAqnolTs2B0i8pgHQwAi8BRG5j+hQoOY//eks3MQopaIy Qyxk+rJX6DHHkp91eGhYu8+PQh2agDK2j1kgoj3oheeBRmSX/UXJ1IU3AH8S0b/DXDx2 Sc1gsTTU/FMzfzk8AJlQgW4e+wHSoJOkoEOuFaNHXnNeWXpV4ND2XQYezl+dA7NnUpfs R7L7SfvBbiAcOWDlJyxhZqcXfNh/ivkCPuiQfWWMZPbp6qA/aRUFIQUB4lQcHqIqxbVd v6oA== 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:arc-authentication-results; bh=3vo7X0uNsw1iOa/lgt5aU+EjS3poL9A4jSv1KuVNdCU=; b=dC5wYFVI4LRJzljnMelPIsvEZhnohAOqJveeZfD+amLXU+j2XnJkSj2HSu7Hgt6b6e +G/qT/luMeCPB3C0jtG+HPemFOTAm/PuKc1ffBUB/nbIO97gjgx1d5vM3BJ7h96638sp Q4QD6DOwK5ThiDR9wfD+8u4TY9tjDudQHNyiPw4I4Mz09I9LmiOENXEl4Cn/dJNiFjQG d+pLqRJ1ICMgpmzhjs0AtHzoIQlMEMmA6aVtO35fdNIUXbfAexXEPdFCLm1vRCsxCq1x OUdVreh5j4C9jGvZGftOV6wSSHowl+ANuz3qLO8sfe3noPxWG0gmqXmcTHuvmrJ1bHd2 XQLA== 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 34-v6si3279426plm.495.2018.04.19.04.00.06; Thu, 19 Apr 2018 04:00:07 -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 S1752819AbeDSLAE (ORCPT + 29 others); Thu, 19 Apr 2018 07:00:04 -0400 Received: from foss.arm.com ([217.140.101.70]:35890 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752617AbeDSK7D (ORCPT ); Thu, 19 Apr 2018 06:59:03 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D3C2315BE; Thu, 19 Apr 2018 03:59:02 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9FBF23F59D; Thu, 19 Apr 2018 03:59:00 -0700 (PDT) From: Dave Martin To: linux-kernel@vger.kernel.org Cc: Catalin Marinas , Will Deacon , Ralf Baechle , James Hogan , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "David S. Miller" , Ingo Molnar , Peter Zijlstra , Steven Rostedt , Oleg Nesterov , linux-arch@vger.kernel.org Subject: [RFC PATCH 3/6] arm64: Use update{,_tsk}_thread_flag() Date: Thu, 19 Apr 2018 11:58:45 +0100 Message-Id: <1524135528-28561-4-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1524135528-28561-1-git-send-email-Dave.Martin@arm.com> References: <1524135528-28561-1-git-send-email-Dave.Martin@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch uses the new update_thread_flag() helpers to simplify a couple of if () set; else clear; constructs. No functional change. Signed-off-by: Dave Martin Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/kernel/fpsimd.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) -- 2.1.4 Acked-by: Will Deacon diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 87a3536..0c4e7e0 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -618,10 +618,8 @@ int sve_set_vector_length(struct task_struct *task, task->thread.sve_vl = vl; out: - if (flags & PR_SVE_VL_INHERIT) - set_tsk_thread_flag(task, TIF_SVE_VL_INHERIT); - else - clear_tsk_thread_flag(task, TIF_SVE_VL_INHERIT); + update_tsk_thread_flag(task, TIF_SVE_VL_INHERIT, + flags & PR_SVE_VL_INHERIT); return 0; } @@ -902,7 +900,7 @@ void fpsimd_thread_switch(struct task_struct *next) if (current->mm) task_fpsimd_save(); - if (next->mm) { + if (next->mm) /* * If we are switching to a task whose most recent userland * FPSIMD state is already in the registers of *this* cpu, @@ -910,13 +908,10 @@ void fpsimd_thread_switch(struct task_struct *next) * the TIF_FOREIGN_FPSTATE flag so the state will be loaded * upon the next return to userland. */ - if (__this_cpu_read(fpsimd_last_state.st) == - &next->thread.uw.fpsimd_state - && next->thread.fpsimd_cpu == smp_processor_id()) - clear_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE); - else - set_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE); - } + update_tsk_thread_flag(next, TIF_FOREIGN_FPSTATE, + __this_cpu_read(fpsimd_last_state.st) != + &next->thread.uw.fpsimd_state || + next->thread.fpsimd_cpu != smp_processor_id()); } void fpsimd_flush_thread(void)