From patchwork Sat Jul 11 20:25:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Daney X-Patchwork-Id: 6771341 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6C42F9F2F0 for ; Sat, 11 Jul 2015 20:29:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 847F320672 for ; Sat, 11 Jul 2015 20:29:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8A9492066B for ; Sat, 11 Jul 2015 20:29:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZE1LZ-0006Te-10; Sat, 11 Jul 2015 20:26:05 +0000 Received: from mail-ie0-x22b.google.com ([2607:f8b0:4001:c03::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZE1LM-0006JU-0X for linux-arm-kernel@lists.infradead.org; Sat, 11 Jul 2015 20:25:52 +0000 Received: by ietj16 with SMTP id j16so41595761iet.0 for ; Sat, 11 Jul 2015 13:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=It5O9xP04KwBMwv0wRmLp9yfRnAPOMrozPDVmx4czcw=; b=bMFGb1kbnjhKGCG/NxSLVqlwqGHX5+tyYU0oVLOUdmarl/biWtxEszyJyEekjWYUbv M2Lh/zXzcdh10k1nxn+S7fT0W8r7JfJLUy8tzNKrf2ddp2UvfovTepLRiHS4sEoPO52G ZphX8zVD9tASA0JIRvDOQem2u2EUUlMt/SXxDESjXoFfs4c1iWq5is1+CIbJahCqTseU Q3Rfgl49aEQkbFgvrlFakcmnqsagvSMxXNVMbfYhetg0gwXMVoYTwOJJv0gLmaGFitbR t6n2G+fBM9UxKui75s9TJk0Xitj9LxFgIuv9+1ygIS9kEK+LqPk1J7pGxzKap54prI0B 5QZw== X-Received: by 10.107.10.93 with SMTP id u90mr10678532ioi.160.1436646329866; Sat, 11 Jul 2015 13:25:29 -0700 (PDT) Received: from dl.caveonetworks.com (64.2.3.194.ptr.us.xo.net. [64.2.3.194]) by smtp.gmail.com with ESMTPSA id 76sm9206001iom.12.2015.07.11.13.25.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 11 Jul 2015 13:25:27 -0700 (PDT) Received: from dl.caveonetworks.com (localhost.localdomain [127.0.0.1]) by dl.caveonetworks.com (8.14.5/8.14.5) with ESMTP id t6BKPQKB010571; Sat, 11 Jul 2015 13:25:26 -0700 Received: (from ddaney@localhost) by dl.caveonetworks.com (8.14.5/8.14.5/Submit) id t6BKPPIo010570; Sat, 11 Jul 2015 13:25:25 -0700 From: David Daney To: linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon Subject: [PATCH 2/3] arm64, mm: Use flush_tlb_all_local() in flush_context(). Date: Sat, 11 Jul 2015 13:25:22 -0700 Message-Id: <1436646323-10527-3-git-send-email-ddaney.cavm@gmail.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1436646323-10527-1-git-send-email-ddaney.cavm@gmail.com> References: <1436646323-10527-1-git-send-email-ddaney.cavm@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150711_132552_106311_E29E272B X-CRM114-Status: GOOD ( 13.22 ) X-Spam-Score: -2.0 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , Andrew Morton , linux-kernel@vger.kernel.org, David Daney MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: David Daney When CONFIG_SMP, we end up calling flush_context() on each CPU (indirectly) from __new_context(). Because of this, doing a broadcast TLB invalidate is overkill, as all CPUs will be doing a local invalidation. Change the scope of the TLB invalidation operation to be local, resulting in nr_cpus invalidations, rather than nr_cpus^2. On CPUs with a large ASID space this operation is not often done. But, when it is, this reduces the overhead. Benchmarked "time make -j48" kernel build with and without the patch on Cavium ThunderX system, one run to warm up the caches, and then five runs measured: original with-patch 139.299s 139.0766s S.D. 0.321 S.D. 0.159 Probably a little faster, but could be measurement noise. Signed-off-by: David Daney --- arch/arm64/mm/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c index 76c1e6c..ab5b8d3 100644 --- a/arch/arm64/mm/context.c +++ b/arch/arm64/mm/context.c @@ -48,7 +48,7 @@ static void flush_context(void) { /* set the reserved TTBR0 before flushing the TLB */ cpu_set_reserved_ttbr0(); - flush_tlb_all(); + flush_tlb_all_local(); if (icache_is_aivivt()) __flush_icache_all(); }