From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6323228695 for ; Wed, 5 Nov 2025 21:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762378162; cv=none; b=PFT18mwD6spK3Svv7uk5Am/TRdjPC9B/ZzPWIsbtpmyvT2LOFqI2rnlwdTG3SwT/UUs6jFiAHo7T98+ieOhqumlS8OY0R7bdqAeCMDqc2t34wQdv+H7jJjPAZvwmS2jqyTGZR+lKl1asPFc5vYhAcJO7PHuXycXqxtZ0V6VALnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762378162; c=relaxed/simple; bh=PAlZ6tNkRMkFTMYnzRbwscVzdBJrBlWT3kjK7f2AI7s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=SEP7Phuy/558rlh+qQKpcvdNpcZSeofYuLQooZ3Y8DTvYIdQScMvREe9EI+dKt+TAG9mGdn0nLm+Dz1POpsZfID5ZGjiRvkVUXw2jt2U4mYHHY65tyReurW0MyI4Aga//MoC0XQFNS9ty1Qp7+UC7Yp+FbKH5JYGrRs+GeDZLyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=je8ivg3q; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="je8ivg3q" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-4283be7df63so146725f8f.1 for ; Wed, 05 Nov 2025 13:29:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762378159; x=1762982959; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=6FXHSyf2tmThjEU70iMaM/iQ+kQ6AR9dxeHlynBInUg=; b=je8ivg3qNRWkcbC9jLHd7gNGYTWySEogHAKOKKuu7+YvltCk74Psr3GfL+BYpmfBVk tmmWGTcN1qcJRaKqXEHPAjzJ/BsA6HH7E+7YYPYN65DoKAC0oq4hQx3meFta0VAasN3P sRKgMNhjFZSyhvSD+0rByGvgMwlt8tGbqeFKWr2GggkqXjfGZUcwJA2cTeAPeFOn6WTc qDjhRRjBT5dIvlvV4n9ASBxhYghJExkCblTsxE75YGuWgJMB/g73v/YqbwKHBlGFJcpn tlA6hds5Jx36yzW+o5jZMyTgBApqND2xcHspff3Mx6ZC6MrLf2DyaYWVTJnlqPqTyxpc B2Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762378159; x=1762982959; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=6FXHSyf2tmThjEU70iMaM/iQ+kQ6AR9dxeHlynBInUg=; b=JeCwjCJ/dLICSE7Hid4Ml6xpoeXi3UPpGNRZ2UHwoinSWm57zSHP9DDa9vEBLaN0G0 SEGTPf1PucZjBA/92Xp5UNwvFA2YzRcS52sp0Sv9sstSzbaQrK8JBp9CAWN1D+yh7UeV V/8lAkgALandYLmsYzOZ5A2+dkN7GVNOF+Osj1gyM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: by 2002:a05:6000:410a:b0:429:bbfa:2305 with SMTP id ffacd0b85a97d-429e330579dmr3946595f8f.35.1762378158606; Wed, 05 Nov 2025 13:29:18 -0800 (PST) Received: from ?IPV6:2003:d8:2f30:b00:cea9:dee:d607:41d? (p200300d82f300b00cea90deed607041d.dip0.t-ipconnect.de. [2003:d8:2f30:b00:cea9:dee:d607:41d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-429eb403747sm874380f8f.4.2025.11.05.13.29.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Nov 2025 13:29:17 -0800 (PST) Message-ID: Date: Wed, 5 Nov 2025 22:29:14 +0100 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 02/16] mm: introduce leaf entry type and use to simplify leaf entry logic To: Lorenzo Stoakes Cc: Gregory Price , Matthew Wilcox , Andrew Morton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Sven Schnelle , Peter Xu , Alexander Viro , Christian Brauner , Jan Kara , Arnd Bergmann , Zi Yan , Baolin Wang , "Liam R . Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Muchun Song , Oscar Salvador , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Ying Huang , Alistair Popple , Axel Rasmussen , Yuanchu Xie , Wei Xu , Kemeng Shi , Kairui Song , Nhat Pham , Baoquan He , Chris Li , SeongJae Park , Jason Gunthorpe , Leon Romanovsky , Xu Xin , Chengming Zhou , Jann Horn , Miaohe Lin , Naoya Horiguchi , Pedro Falcato , Pasha Tatashin , Rik van Riel , Harry Yoo , Hugh Dickins , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, damon@lists.linux.dev References: <2c75a316f1b91a502fad718de9b1bb151aafe717.1762171281.git.lorenzo.stoakes@oracle.com> <373a0e43-c9bf-4b5b-8d39-4f71684ef883@lucifer.local> <7f507cb7-f6aa-4f52-b0b5-8f0f27905122@gmail.com> <2d1f420e-c391-487d-a3cc-536eb62f3518@lucifer.local> <563246df-cca4-4d21-bad0-7269ab5a419c@gmail.com> <52dd0c85-9e06-4cb2-a9f9-71662922cba9@lucifer.local> From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: <52dd0c85-9e06-4cb2-a9f9-71662922cba9@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05.11.25 22:24, Lorenzo Stoakes wrote: > On Wed, Nov 05, 2025 at 10:15:51PM +0100, David Hildenbrand (Red Hat) wrote: >> On 05.11.25 22:08, Lorenzo Stoakes wrote: >>> On Wed, Nov 05, 2025 at 09:11:45PM +0100, David Hildenbrand (Red Hat) wrote: >>>> On 05.11.25 21:05, Lorenzo Stoakes wrote: >>>>> On Wed, Nov 05, 2025 at 03:01:00PM -0500, Gregory Price wrote: >>>>>> On Wed, Nov 05, 2025 at 07:52:36PM +0000, Lorenzo Stoakes wrote: >>>>>>> On Wed, Nov 05, 2025 at 02:25:34PM -0500, Gregory Price wrote: >>>>>>>> On Wed, Nov 05, 2025 at 07:06:11PM +0000, Matthew Wilcox wrote: >>>>>>> I thought about doing this but it doesn't really work as the type is >>>>>>> _abstracted_ from the architecture-specific value, _and_ we use what is >>>>>>> currently the swp_type field to identify what this is. >>>>>>> >>>>>>> So we would lose the architecture-specific information that any 'hardware leaf' >>>>>>> entry would require and not be able to reliably identify it without losing bits. >>>>>>> >>>>>>> Trying to preserve the value _and_ correctly identify it as a present entry >>>>>>> would be difficult. >>>>>>> >>>>>>> And I _really_ didn't want to go on a deep dive through all the architectures to >>>>>>> see if we could encode it differently to allow for this. >>>>>>> >>>>>>> Rather I think it's better to differentiate between s/w + h/w leaf entries. >>>>>>> >>>>>> >>>>>> Reasonable - names are hard, but just about anything will be better than swp_entry. >>>>>> >>>>>> SWE / sw_entry seems perfectly reasonable. >>>>> >>>>> I'm not a lover of 'sw' in there it's just... eye-stabby. Is that a word? >>>>> >>>>> I am quite fond of my suggested soft_leaf_t, softleaf_xxx() >>>> >>>> We do have soft_dirty. >>>> >>>> It will get interesting with pte_swp_soft_dirty() :) >>> >>> Hmm but that's literally a swap entry, and is used against an actual PTE entry >>> not an abstracted s/w leaf entry so I doubt that'd require renaming on any >>> level. >> >> It's used on migration entries as well. Just like pte_swp_uffd_wp(). >> >> So, it's ... tricky :) >> >> But maybe I am missing your point (my brain is exhausted from uffd code) > > We'd either not rename it or rename it to something like pte_is_uffd_wp(). So > it's not even so relevant. We do have pte_uffd_wp() for present ptes. > > We'd probably call that something like pte_is_soft_dirty() in the soft dirty > case. The 'swp' part of that is pretty redundant. We do have pte_soft_dirty() for present ptes. So we'd need some indication that these are for softleaf entries (where the bit positions will differ). > > If people were insistent on having softleaf in there we could call it > pte_softleaf_is_soft_dirty() which isn't qutie so bad. But I'd not want to put > softleaf in there anyway. > > sw_entry or sw_leaf or sw_leaf_entry would all have the same weirdness. > > I want it to be something that is readable + not hideous to look at but still > clear as to what it's referring too. Softleaf covers all of that off... :) I think you misunderstood me: I have nothing against softleaf, I was rather saying that we already use the "soft" terminology elsewhere (soft_dirt), so it's not too crazy.