Received: by 10.213.65.68 with SMTP id h4csp1284473imn; Wed, 21 Mar 2018 07:09:48 -0700 (PDT) X-Google-Smtp-Source: AG47ELsx5jtX1SNnxOt5TYICGXdUV2NB3hIX1O9vmtfThRVzFNHIHK1k1VLXZrgzVD+69mBX4Ied X-Received: by 10.98.185.11 with SMTP id z11mr16995080pfe.153.1521641388735; Wed, 21 Mar 2018 07:09:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521641388; cv=none; d=google.com; s=arc-20160816; b=Yv6XRp1Kx4P0G1lU/peO59iKhuig9uo7EHyCE2E8FsQLjF6uOCQOCfjmvaA17Gci2m gPg5z1zUL10Cf3rYSP2hTipagEiRalIfPdlYUxJO37wLDKefMh7q4P7nF9UL/6+Mjoo9 PNhJbuL0eAsLkaiXJhaarRGcnBNzpTGI5RwlpJAwv7sh65WmdMI8Ldxtq52j2/DmkWo8 Ls21rAU4JorjERodVmSEEdjTLuETz8vvrPR8smeLIrP3jbtJg3wc4JpSTlO61mqzx/08 mJG2r9/3qxA4OmUVc9MMGl4PtODQOZ3RtXCtnxB7kUTBcA27u5IVga5MUMSa/IVbpG1O /HyQ== 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=c4ENAglxjT2uWenjbK9Ag2+A6vW520zyK05CSNrQwZk=; b=Y1bak3eAIyBt9pA/C1zVyVSORLikkYRXrBXnl23LaLqybtFHp5ojxcOEjJVH9+3WQ5 oLgg99Q870+6A4cko7slW01y/1ez5drbBANRoILnwLeczTDulMDpJ52+JnLF3kWIOCOH VOwXU+4MQHOvsitmTJZJDYRzojeH8fXe/FC+woqW6ePVSMLIRlL9KtyiAIRvhXfGei30 ZYRpC75SwfjjReokNS2Hp2j2FWKPjNNyR/CZKQ+r81SYNFGSNDCRzmPAZGdFc1SDJQOV ozqrVkqQ/DJbZVuxXxaZW20iFUrY+epihFOS+3wfTgoRrTyBSgXgcbtEC6oMwDhgdwON lVvw== 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 d81si3203587pfd.210.2018.03.21.07.09.34; Wed, 21 Mar 2018 07:09:48 -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 S1752417AbeCUOII (ORCPT + 99 others); Wed, 21 Mar 2018 10:08:08 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:41437 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752173AbeCUOHz (ORCPT ); Wed, 21 Mar 2018 10:07:55 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 405s7z5gkNz9ttfw; Wed, 21 Mar 2018 15:07:43 +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 b3M_0zWE3pBJ; Wed, 21 Mar 2018 15:07:43 +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 405s7z4wT2z9ttBw; Wed, 21 Mar 2018 15:07:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2C7E98B805; Wed, 21 Mar 2018 15:07:54 +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 reRFmzBYMdZe; Wed, 21 Mar 2018 15:07:54 +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 E955A8B802; Wed, 21 Mar 2018 15:07:53 +0100 (CET) Received: by po15720vm.idsi0.si.c-s.fr (Postfix, from userid 0) id DC21E6F392; Wed, 21 Mar 2018 15:07:53 +0100 (CET) Message-Id: <4fe13c13918bb6c42e4c2e61add9a6937e674da9.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 4/4] powerpc/mm: Remove stale_map[] handling on non SMP processors 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:53 +0100 (CET) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org stale_map[] bits are only set in steal_context_smp() so on UP processors this map is useless. Only manage it for SMP processors. Signed-off-by: Christophe Leroy --- arch/powerpc/mm/mmu_context_nohash.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c index 625c17049483..3f13f07f64dd 100644 --- a/arch/powerpc/mm/mmu_context_nohash.c +++ b/arch/powerpc/mm/mmu_context_nohash.c @@ -88,7 +88,9 @@ static unsigned int next_context, nr_free_contexts; static unsigned long *context_map; +#ifdef CONFIG_SMP static unsigned long *stale_map[NR_CPUS]; +#endif static struct mm_struct **context_mm; static DEFINE_RAW_SPINLOCK(context_lock); @@ -169,7 +171,9 @@ static unsigned int steal_context_smp(unsigned int id) static unsigned int steal_all_contexts(void) { struct mm_struct *mm; +#ifdef CONFIG_SMP int cpu = smp_processor_id(); +#endif unsigned int id; for (id = FIRST_CONTEXT; id <= LAST_CONTEXT; id++) { @@ -187,7 +191,9 @@ static unsigned int steal_all_contexts(void) mm->context.active = 0; #endif } +#ifdef CONFIG_SMP __clear_bit(id, stale_map[cpu]); +#endif } /* Flush the TLB for all contexts (not to be used on SMP) */ @@ -206,7 +212,9 @@ static unsigned int steal_all_contexts(void) static unsigned int steal_context_up(unsigned int id) { struct mm_struct *mm; +#ifdef CONFIG_SMP int cpu = smp_processor_id(); +#endif /* Pick up the victim mm */ mm = context_mm[id]; @@ -220,7 +228,9 @@ static unsigned int steal_context_up(unsigned int id) mm->context.id = MMU_NO_CONTEXT; /* XXX This clear should ultimately be part of local_flush_tlb_mm */ +#ifdef CONFIG_SMP __clear_bit(id, stale_map[cpu]); +#endif return id; } @@ -259,7 +269,10 @@ static void context_check_map(void) { } void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, struct task_struct *tsk) { - unsigned int i, id, cpu = smp_processor_id(); + unsigned int id; +#ifdef CONFIG_SMP + unsigned int i, cpu = smp_processor_id(); +#endif unsigned long *map; /* No lockless fast path .. yet */ @@ -333,6 +346,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, /* If that context got marked stale on this CPU, then flush the * local TLB for it and unmark it before we use it */ +#ifdef CONFIG_SMP if (test_bit(id, stale_map[cpu])) { pr_hardcont(" | stale flush %d [%d..%d]", id, cpu_first_thread_sibling(cpu), @@ -347,6 +361,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next, __clear_bit(id, stale_map[i]); } } +#endif /* Flick the MMU and release lock */ pr_hardcont(" -> %d\n", id); @@ -452,9 +467,7 @@ void __init mmu_context_init(void) */ context_map = memblock_virt_alloc(CTX_MAP_SIZE, 0); context_mm = memblock_virt_alloc(sizeof(void *) * (LAST_CONTEXT + 1), 0); -#ifndef CONFIG_SMP - stale_map[0] = memblock_virt_alloc(CTX_MAP_SIZE, 0); -#else +#ifdef CONFIG_SMP stale_map[boot_cpuid] = memblock_virt_alloc(CTX_MAP_SIZE, 0); cpuhp_setup_state_nocalls(CPUHP_POWERPC_MMU_CTX_PREPARE, -- 2.13.3