From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF1FCC433F5 for ; Mon, 25 Oct 2021 10:50:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A7F060FDC for ; Mon, 25 Oct 2021 10:50:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6A7F060FDC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id DB73B6B006C; Mon, 25 Oct 2021 06:50:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D66DF6B0072; Mon, 25 Oct 2021 06:50:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7D5B6B0073; Mon, 25 Oct 2021 06:50:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id B96516B006C for ; Mon, 25 Oct 2021 06:50:24 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 73ADB182BD9F5 for ; Mon, 25 Oct 2021 10:50:24 +0000 (UTC) X-FDA: 78734640768.18.9EB02AA Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf13.hostedemail.com (Postfix) with ESMTP id 76AEA1045C9B for ; Mon, 25 Oct 2021 10:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AtflKn9bp06brgCugEneui+etGBY4mbNQIR0pbDmQoY=; b=BnDJsnSzS7C40GT2l6lSw1Flly dTvjtMOemG5ilFsrGuWDohzFH2TRnexni/NDH3DN5j3iYzZb+lhGzKofzOLMv+JOFRL6+rasUc5kV q2qR1exopNlvVINuc/xpDbPGPwqgT5GpVsOBALhcBAT05KfXK5rhCQpqb3zlWqKxVPscYne8XWZ59 ImtU+ciA0EJxWAbOikC/GQ5w0VYMkAcio4X/M22pAcPBCix8HDtKKbZQI44d30Mu1Lz00EJuhW4Ja Jnyi6QGA0VmX8MFTefItBSdLqagwJ6NpZr7ItN+P5XJkv5TUQMKz9ZE5vcPVgVkb4U8joTt7CyU19 x26Hge3g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mexYI-00C83t-8s; Mon, 25 Oct 2021 10:50:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D8289300095; Mon, 25 Oct 2021 12:50:00 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AB14F26642EE9; Mon, 25 Oct 2021 12:50:00 +0200 (CEST) Date: Mon, 25 Oct 2021 12:50:00 +0200 From: Peter Zijlstra To: Andrew Morton Cc: Nadav Amit , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nadav Amit , Andi Kleen , Andrea Arcangeli , Andrew Cooper , Andy Lutomirski , Dave Hansen , Peter Xu , Thomas Gleixner , Will Deacon , Yu Zhao , Nick Piggin , x86@kernel.org Subject: Re: [PATCH v2 0/5] mm/mprotect: avoid unnecessary TLB flushes Message-ID: References: <20211021122112.592634-1-namit@vmware.com> <20211021200450.b13499c379a27dbfefe9f5e3@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211021200450.b13499c379a27dbfefe9f5e3@linux-foundation.org> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 76AEA1045C9B X-Stat-Signature: kn3q58mocjb9gtocb6ezd996x5xprye3 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=BnDJsnSz; spf=none (imf13.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none X-HE-Tag: 1635159018-203951 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Oct 21, 2021 at 08:04:50PM -0700, Andrew Morton wrote: > On Thu, 21 Oct 2021 05:21:07 -0700 Nadav Amit wrote: > > > This patch-set is intended to remove unnecessary TLB flushes. It is > > based on feedback from v1 and several bugs I found in v1 myself. > > > > Basically, there are 3 optimizations in this patch-set: > > 1. Avoiding TLB flushes on change_huge_pmd() that are only needed to > > prevent the A/D bits from changing. > > 2. Use TLB batching infrastructure to batch flushes across VMAs and > > do better/fewer flushes. > > 3. Avoid TLB flushes on permission demotion. > > > > Andrea asked for the aforementioned (2) to come after (3), but this > > is not simple (specifically since change_prot_numa() needs the number > > of pages affected). > > [1/5] appears to be a significant fix which should probably be > backported into -stable kernels. If you agree with this then I suggest > it be prepared as a standalone patch, separate from the other four > patches. With a cc:stable. I am confused, 1/5 doesn't actually do *anything*. I also cannot find any further usage of the introduced X86_BUG_PTE_LEAK. I'm thinking patch #2 means to have something like: if (cpu_feature_enabled(X86_BUG_PTE_LEAK)) flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE); In the newly minted: pmdp_invalidate_ad(), but alas, nothing there.