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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED1E7C369C2 for ; Fri, 25 Apr 2025 08:54:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D4306B0022; Fri, 25 Apr 2025 04:54:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A9C06B0023; Fri, 25 Apr 2025 04:54:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7715D6B0024; Fri, 25 Apr 2025 04:54:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5BC276B0022 for ; Fri, 25 Apr 2025 04:54:46 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 5CCEF1C97B8 for ; Fri, 25 Apr 2025 08:54:47 +0000 (UTC) X-FDA: 83371955814.04.E5BF3CF Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id A11F84000D for ; Fri, 25 Apr 2025 08:54:45 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Yq49QPNm; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of mingo@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=mingo@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745571285; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OvKKzISSqIcbcvSiLmLONb8Zkyk7bMa57slcSP9iOOs=; b=l7zlFL7xx5IS9RErP+jBgBeWKMLUWrPPNVUowsyKK1Uw2a7j1nwn12E+ixtG1H8EgzIv0Q ER53GIQB4/84u5PDT8yHNyYjjVsWej5zas40wR0wnD67OscxigHYuFmpsfqODCJvYhMwTP PLQOCkd+8ybsdM+wi4UfGBZtK69p3A0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745571285; a=rsa-sha256; cv=none; b=dqRhAwCy5qaEMRxcoxjmQeLnufd33lHgtB2XoffaA3+SUBaczn6pWWxYPw4HIzxjoQ2+/V GAvlcjWNraaXQehdj99/VY7LkcqYGAO6oYgrPLReie8W0NcW5DY2MIAnT63guul2sF7bFN ALMwsD/5/utn7qywcZ66TGXoPdxXchU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Yq49QPNm; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf12.hostedemail.com: domain of mingo@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=mingo@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 501615C64A0; Fri, 25 Apr 2025 08:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 993C5C4CEE4; Fri, 25 Apr 2025 08:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745571284; bh=byos0KBTq/TSuKpnONmQSZ/S7MqfhwZ6bkrEWjklef8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Yq49QPNm8JISyJIWA2gTjzx9WngHH+jHBnH+w++QZ4pLMPSVcKMh0Ut10d2/xzj7u DHBPjAgGLWsLqEba9tvqZ60cDvalmVmpUC0shPA/dfsmSMelBP/17e4an3ddQJxLZJ 9PVdU9hqvVyqjF91HUSMPadBgv/Yy/GhiJNOEpJpM3Mg6f52UlfpguAqQzY1o/b7FV yESvey9PKaic4QrnwGUnY/tD+pTwnEQluFLVZqjr3akxgz2J33cQ+0+zVzRf3kNL6S G6eKTst6v2EoKA75j2SpeC2gRocKxR7Ua0Um4vA9GT+1140PqAUvt/5qTml+9HmhFO Rt5+CrLgQldkA== Date: Fri, 25 Apr 2025 10:54:35 +0200 From: Ingo Molnar To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-trace-kernel@vger.kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , David Airlie , Simona Vetter , Andrew Morton , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , "Liam R. Howlett" , Lorenzo Stoakes , Vlastimil Babka , Jann Horn , Pedro Falcato , Peter Xu Subject: Re: [PATCH v1 00/11] mm: rewrite pfnmap tracking and remove VM_PAT Message-ID: References: <20250425081715.1341199-1-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250425081715.1341199-1-david@redhat.com> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A11F84000D X-Rspam-User: X-Stat-Signature: 9mu39pabecmao8xbroz4rqzduwtxwu7i X-HE-Tag: 1745571285-780342 X-HE-Meta: U2FsdGVkX1/nocjKbaqKI1YRjaEhPW9gw4D7nhkEhiv8Q/E2ZLmDrNr7uq5x5DGa1xS92cxi4OrrZSi3ZUFHa1kU6Es3zRYkwK4zgboYMgOYhdnFc4jiDG4TX51AJm5jHdREhWRheuZQWvFyDYcJYesQPFBTyZmTNjEqDmxSTx5hRiU0ILiZ06mRDOWIr3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8BeAujy7o6tUyx1Rj7EK+PdSYtHgw== 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: List-Subscribe: List-Unsubscribe: * David Hildenbrand wrote: > On top of mm-unstable. > > VM_PAT annoyed me too much and wasted too much of my time, let's clean > PAT handling up and remove VM_PAT. > > This should sort out various issues with VM_PAT we discovered recently, > and will hopefully make the whole code more stable and easier to maintain. > > In essence: we stop letting PAT mode mess with VMAs and instead lift > what to track/untrack to the MM core. We remember per VMA which pfn range > we tracked in a new struct we attach to a VMA (we have space without > exceeding 192 bytes), use a kref to share it among VMAs during > split/mremap/fork, and automatically untrack once the kref drops to 0. Yay! The extra pointer in vm_area_struct is a small price to pay IMHO. > This implies that we'll keep tracking a full pfn range even after partially > unmapping it, until fully unmapping it; but as that case was mostly broken > before, this at least makes it work in a way that is least intrusive to > VMA handling. > > Shrinking with mremap() used to work in a hacky way, now we'll similarly > keep the original pfn range tacked even after this form of partial unmap. > Does anybody care about that? Unlikely. If we run into issues, we could > likely handled that (adjust the tracking) when our kref drops to 1 while > freeing a VMA. But it adds more complexity, so avoid that for now. > > Briefly tested > > There will be some clash with [1], but nothing that cannot be sorted out > easily by moving the functions added to kernel/fork.c to wherever the vma > bits will live. > > Briefly tested with some basic /dev/mem test I crafted. I want to convert > them to selftests, but that might or might not require a bit of > more work (e.g., /dev/mem accessibility). So for the x86 bits, once it passes review by the fine MM folks: Acked-by: Ingo Molnar And I suppose this rewrite will be carried in -mm? Thanks, Ingo