Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7375004rdb; Wed, 3 Jan 2024 13:54:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IFLF8oAua6sUSZXzjEd9ITKwbZMo758r/AT8vq3e9JHd50dDBT2SDvfeBqJ1bMJyaFkroeY X-Received: by 2002:a05:620a:4115:b0:781:bd78:d984 with SMTP id j21-20020a05620a411500b00781bd78d984mr7908234qko.43.1704318884822; Wed, 03 Jan 2024 13:54:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704318884; cv=none; d=google.com; s=arc-20160816; b=Jz0aCRqGYCC6HjwNdP+Nr7UDHsdEj4xqO0E+O3Sc5+CcREMf0BD5eCSQNJYalbweVn HLXRfMa0xLtB9HKn8Z7ZdQfP1yql3HcvZWwoMIkarS7LM3tGQYydCq/4yh+hyIl7FI+D 3S63B8x938wwEg18Eb26eBLV9bBGuMuVwoYLTv+nSPhZmrnjycpm1p4KLpzONar812Bj HtJ4R9hbtk1sGWeLNhB4zz39IhX4sBY7WhqP2tnSr6uWhAD1xOrywJg/7/u6/CJ5iryk ymCcbi99gxqSK2QiCfsIC8Vh1v5gx4asi37GnLsv6ZEndzqOz30HVOJJ11pxAT3xK971 1qqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=w4L7JZaV2zso8bsSUDUfwlwgBri9fzfbGapvXWaWPFU=; fh=4PFWHcZirNvljGYeO6o42RAm+Pp6zfpZtc1u5dlD+Iw=; b=mGAb2ROACZdGKPEqoWSpPWRYkpduccQP2gMOvZJVJ7eEdBNa0gF1pcc5P7dr8bvAqs kueF6p2t9d6MivvN2q1pdcHPf8C6fXU8U0zOz6tsWxMw7Mv4dZ9MJIV/QYQ8mtr0z/SA ypShGy8J1zvCphgwBANAREoVCLVudtxv2JSv7UP6ZEZe7pu4afszB0r1WaklhDPI6pBE lGpl2UwlEk49Fc2T7uax08/bX7u/0/qTpbYr7mtJo5VCYT0jNYVHop6V2Lkk/yxjpHH2 /eO8U6XKV34oojtPmZkFGwJi+rhD9B442l1q57mwxHgQ9MTH2rTfVCVKFmvqZ4snl4fa /mZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16038-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g7-20020a05620a40c700b007815e8d7d9bsi17389666qko.408.2024.01.03.13.54.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 13:54:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-16038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-16038-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-16038-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9443E1C23B1C for ; Wed, 3 Jan 2024 21:54:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BE5BC1DA32; Wed, 3 Jan 2024 21:54:39 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4EAD51DA28; Wed, 3 Jan 2024 21:54:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCD1BC433C8; Wed, 3 Jan 2024 21:54:34 +0000 (UTC) Date: Wed, 3 Jan 2024 21:54:32 +0000 From: Catalin Marinas To: Dave Hansen Cc: Jisheng Zhang , Will Deacon , "Aneesh Kumar K . V" , Andrew Morton , Nick Piggin , Peter Zijlstra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Arnd Bergmann , linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Nadav Amit , Andrea Arcangeli , Andy Lutomirski , Dave Hansen , Thomas Gleixner , Yu Zhao , x86@kernel.org Subject: Re: [PATCH 1/2] mm/tlb: fix fullmm semantics Message-ID: References: <20231228084642.1765-1-jszhang@kernel.org> <20231228084642.1765-2-jszhang@kernel.org> <6ee6340a-ffe2-4106-b845-47cf443558c3@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6ee6340a-ffe2-4106-b845-47cf443558c3@intel.com> On Wed, Jan 03, 2024 at 12:26:29PM -0800, Dave Hansen wrote: > On 1/3/24 10:05, Catalin Marinas wrote: > >> --- a/mm/mmu_gather.c > >> +++ b/mm/mmu_gather.c > >> @@ -384,7 +384,7 @@ void tlb_finish_mmu(struct mmu_gather *tlb) > >> * On x86 non-fullmm doesn't yield significant difference > >> * against fullmm. > >> */ > >> - tlb->fullmm = 1; > >> + tlb->need_flush_all = 1; > >> __tlb_reset_range(tlb); > >> tlb->freed_tables = 1; > >> } > > The optimisation here was added about a year later in commit > > 7a30df49f63a ("mm: mmu_gather: remove __tlb_reset_range() for force > > flush"). Do we still need to keep freed_tables = 1 here? I'd say only > > __tlb_reset_range(). > > I think the __tlb_reset_range() can be dangerous if it clears > ->freed_tables. On x86 at least, it might lead to skipping the TLB IPI > for CPUs that are in lazy TLB mode. When those wake back up they might > start using the freed page tables. You are right, I did not realise freed_tables is reset in __tlb_reset_range(). -- Catalin