Received: by 10.213.65.68 with SMTP id h4csp1285659imn; Wed, 21 Mar 2018 07:11:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELsvDngr8lM5kfCNEmCHBG2YFjBO/tvH5n4aSRYzs4nzeMhST5EpIQE1bT7ax4je4yGj/KHk X-Received: by 10.101.98.205 with SMTP id m13mr15018601pgv.100.1521641469580; Wed, 21 Mar 2018 07:11:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521641469; cv=none; d=google.com; s=arc-20160816; b=n3YxAMghIoH4Ir7YtIN3yPaSUUmeWfQyP6Hpwc0TTGJV93FDKzFqxsXs6aG0v3a5ww dmV/IqSC8JMNkiLn9nT8ezlC+GjPn+G3LqK8r6WMiqTnV7SZCMO50qBaOEcEWnlFoL5J CBLxxZTRqy7EMjMU9K8JMvZfTL/dax9mAQeJtlLXcKuYVZqscEqIlsGsupccTTEUbvYd gol/5jOI3X81RTvZca6KDdDGqEEscj13sF+a9Wz1uZUx0D7zthN0mFJM/Lf0knJJS/Un F8Uux5GV35BnaqPI8pRsJnvqW5nauUTWy0ZIN7o0GH4Hc2i8IzgW6GYGxc1iRR/7oCRR eBtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:references :in-reply-to:message-id:arc-authentication-results; bh=UIsUPzNLIC3nP3mfhM0+SCfYYNIehmOpyI0hd1+1QLA=; b=jNdkXlKAaisj6opFLp7ICUomoJl+juAsNgzdKYvVAaXBKGQ2jssWWjbLlflNr7EgUO hS50G2t3xJ/NYK3f46CAB5r573LhahLCei6yGY9ucitRNrtgdxIbSg2hkyofzouH9LLH PbVncUBo5FD5oXpN3w5g2NLUeA50B6+Xby02uqGtAp1tQbMbwxwelaZ9FQNF+fpwNhJn xF6Ee7P6O+jWyDr6lRR2AsNZrUmiviwURW3uvoywOuFMe2bPuRRYcsEKEm54smxLzoA8 0dQmLKiIX1qHjW1O5vxVj3QeUekEjXRaBpRFX9av3YxQ+xjqFmIql2uX5ajK9biT1m62 e7Aw== 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 bj5-v6si3767142plb.712.2018.03.21.07.10.31; Wed, 21 Mar 2018 07:11:09 -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 S1752335AbeCUOH4 (ORCPT + 99 others); Wed, 21 Mar 2018 10:07:56 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:61429 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751805AbeCUOHv (ORCPT ); Wed, 21 Mar 2018 10:07:51 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 405s7v4r9qz9ttRv; Wed, 21 Mar 2018 15:07:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id RgtwHs9nozbc; Wed, 21 Mar 2018 15:07:39 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 405s7v4PLMz9ttBw; Wed, 21 Mar 2018 15:07:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1A4518B805; Wed, 21 Mar 2018 15:07:50 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id Rpx-0RCFUyAr; Wed, 21 Mar 2018 15:07:50 +0100 (CET) Received: from po15720vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.30]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D309E8B804; Wed, 21 Mar 2018 15:07:49 +0100 (CET) Received: by po15720vm.idsi0.si.c-s.fr (Postfix, from userid 0) id CC4F16F392; Wed, 21 Mar 2018 15:07:49 +0100 (CET) Message-Id: <00a43265a2759dc284a17b042df633f0717c9dcb.1521641042.git.christophe.leroy@c-s.fr> In-Reply-To: <03c175e506e88e57f48f01de9120768e1b942c6e.1521641042.git.christophe.leroy@c-s.fr> References: <03c175e506e88e57f48f01de9120768e1b942c6e.1521641042.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH 2/4] powerpc/mm: Avoid unnecessary test and reduce code size To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 21 Mar 2018 15:07:49 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org no_selective_tlbil hence the use of either steal_all_contexts() or steal_context_up() depends on the subarch, it won't change during run. Only the 8xx uses steal_all_contexts and CONFIG_PPC_8xx is exclusive of other processors. This patch replaces the test of no_selective_tlbil global var by a test of CONFIG_PPC_8xx selection. It avoids the test and removes unnecessary code. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mmu_context_nohash.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c index 5051c9363f8c..3fbe36266838 100644 --- a/arch/powerpc/mm/mmu_context_nohash.c +++ b/arch/powerpc/mm/mmu_context_nohash.c @@ -62,7 +62,6 @@ static unsigned long *context_map; static unsigned long *stale_map[NR_CPUS]; static struct mm_struct **context_mm; static DEFINE_RAW_SPINLOCK(context_lock); -static bool no_selective_tlbil; #define CTX_MAP_SIZE \ (sizeof(unsigned long) * (last_context / BITS_PER_LONG + 1)) @@ -279,7 +278,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, goto stolen; } #endif /* CONFIG_SMP */ - if (no_selective_tlbil) + if (IS_ENABLED(CONFIG_PPC_8xx)) id = steal_all_contexts(); else id = steal_context_up(id); @@ -440,16 +439,12 @@ void __init mmu_context_init(void) * present if needed. * -- BenH */ - if (mmu_has_feature(MMU_FTR_TYPE_8xx)) { + if (mmu_has_feature(MMU_FTR_TYPE_8xx)) last_context = 16; - no_selective_tlbil = true; - } else if (mmu_has_feature(MMU_FTR_TYPE_47x)) { + else if (mmu_has_feature(MMU_FTR_TYPE_47x)) last_context = 65535; - no_selective_tlbil = false; - } else { + else last_context = 255; - no_selective_tlbil = false; - } #ifdef DEBUG_CLAMP_LAST_CONTEXT last_context = DEBUG_CLAMP_LAST_CONTEXT; -- 2.13.3