Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp514177ybi; Wed, 3 Jul 2019 00:16:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyN4LGANV3pcyCQAHejNIiRNLzucz/kokOMpy+VQ4FOWHkcsRchNTd6dS8YMpYp2REPKV3J X-Received: by 2002:a63:221c:: with SMTP id i28mr31798912pgi.114.1562138182737; Wed, 03 Jul 2019 00:16:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562138182; cv=none; d=google.com; s=arc-20160816; b=LUxMeA8xox2WsyesPBLFLCloPCA1k+gGKxXYkKafceT9l4VX5zFaTg0MgvDOghdIyr LqvrWaaO3ZDjlzu4gEft9xb7psOeXjojOzgFQ8Dtvi8FacMNPucIiIU2rpiCESzV8FqE 6u6gqLGawmUm5Yw9qW+63RY4VvViXeEGwvNnWO/uLpVBrc3mFEZizea5CNttgdJ9Pbja JtLyeVcXrE4v3p/91FyfwDhCMbNdv7B1XVwVXRwfhTBUP7mp0MF2iaoew7TQ89w6tiSj qQJGfGNT1GpE9GrtiNmx8u27jsKkprU87cMzEa/OkW8xkIekErzfjpUnIHuVzJX9WBoc jPwQ== 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=tbMmzT4xwZYMYEeTP8HwE5JwMVGn4vH5RiiY9Z0KVlQ=; b=ua7ju99zL+WAoOgktGc0jS25q9VXFrexXqfSrTRTpQl28twQsmpEmyuOCat4y45o58 M4AQ2pFOWRkYWKb6iPUU5+J4ntVN3I1FuxLHu6Rnbq4AdkAb2fc7I0n41U5CpLqCK9OL tDUkd5yP7Py9sPPhjHLhxf8kijATZUw1SW1fHei6E0dNagl3Wzhvi6VdFIq0QP/vInBB hgWcqbuILwCwqYVd8bBR5XhDPKQvKzy2Hj7fwOD5pcAaMRQ4LKqeByXP0oCVGsEzrtQ5 gUtx/+y07qEG+67ONvM2ynkwRubCDQ69Wj8ldG24RFCPeiQ/yEMoJnbT7wUx51CtBGmw g4Ww== 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i36si1422575plb.365.2019.07.03.00.16.06; Wed, 03 Jul 2019 00:16:22 -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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727361AbfGCHOd (ORCPT + 99 others); Wed, 3 Jul 2019 03:14:33 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:37223 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727266AbfGCHOL (ORCPT ); Wed, 3 Jul 2019 03:14:11 -0400 Received: by mail-pl1-f196.google.com with SMTP id bh12so713903plb.4 for ; Wed, 03 Jul 2019 00:14:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tbMmzT4xwZYMYEeTP8HwE5JwMVGn4vH5RiiY9Z0KVlQ=; b=U7mecXGRjSJtOUXuRdvBvhCV8PW8nqL7qBFsitbJWhVv/l/DxmM2ZNcsO28EFGtkkd cRahKoP3OfFRWzUC3Nq4GdmxuvtZYBKwpNh3TCdYyLE2qnwTJ+nOAUzjHxHlz/3EaDQt aj0U4T7/oyXPQgvOcABokxdU9HKleYd84oX+qKn5Kg77kYf99tvf/k2VDqegyMMci3Xo Zjmag19qvaCaThZpVB1DK01NwO3aInkDarE5dZ3DKFizL75gUeoV9Mx2Olv0J1oYSKO2 ZvcQjP+uZxjPvxwPcmcIbvrK8Rg0LqGkXbwzI1ul80JODVlrw/QKYJ4GrJcRb+E0Wta2 a5Jw== X-Gm-Message-State: APjAAAXbo+3f1sUp+SOeCJ3sVB8b6WcWxwNc6uhmdODpphXwbZzITFD+ vK44lxgRxBbQ//UwH4Rx9fs= X-Received: by 2002:a17:902:f216:: with SMTP id gn22mr39826028plb.118.1562138051132; Wed, 03 Jul 2019 00:14:11 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id j21sm1256593pfh.86.2019.07.03.00.14.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 00:14:10 -0700 (PDT) From: Nadav Amit To: Andy Lutomirski , Dave Hansen Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Nadav Amit Subject: [PATCH v2 6/9] x86/mm/tlb: Do not make is_lazy dirty for no reason Date: Tue, 2 Jul 2019 16:51:48 -0700 Message-Id: <20190702235151.4377-7-namit@vmware.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190702235151.4377-1-namit@vmware.com> References: <20190702235151.4377-1-namit@vmware.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Blindly writing to is_lazy for no reason, when the written value is identical to the old value, makes the cacheline dirty for no reason. Avoid making such writes to prevent cache coherency traffic for no reason. Cc: Andy Lutomirski Cc: Peter Zijlstra Suggested-by: Dave Hansen Signed-off-by: Nadav Amit --- arch/x86/mm/tlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 9bd24aecbd58..b47a71820f35 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -322,7 +322,8 @@ void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, __flush_tlb_all(); } #endif - this_cpu_write(cpu_tlbstate_shared.is_lazy, false); + if (was_lazy) + this_cpu_write(cpu_tlbstate_shared.is_lazy, false); /* * The membarrier system call requires a full memory barrier and -- 2.17.1