From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (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 7E4672D6E5C for ; Wed, 5 Nov 2025 21:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762378162; cv=none; b=L0s/KyLCyk6gHqT/FJk0n5bKtKR0B3q7BvBKvjwEw4j7vKpl9yjyRpjRbCXf06KkqPQZKDYFBPmO4gUsiIsoA3Vl5qbvrrOh0AOOOMoE/i8e7wVuYMHCWQx2++6XqsZSmYzGiE+cXx8bPTKmPjMOAaSp/udXG6g8nYu+zhnABIA= 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.51 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-f51.google.com with SMTP id ffacd0b85a97d-4298b49f103so101229f8f.2 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=OM3yrlR0fMAog4tTlf/nsF42rm2eZm864XRl+BSjobF+J8duCIO1ZEXd5EaoJiBwWn IDP+w2MLRVMOgRDUMPjiEIGD+lxH4N/ThbDdJi7waJeKTLZnUVwzS7dZswzagOJi2XEn 9iulFapgvP3uTObSmhUbyT4ydw4OuNO1n5TuYt2LSglX3chhKhP9lVIL4KX5aGGi3znn gUPf01gUY3TDm6nITSKiCJ3Z1oPUwtGPM48gRzoxtONf8zAbrK/Y4EWw7vJVDF1KgRiA rBU+gpvuumsF6IUzAM9gbHTG0ly5se+UFq+M7cFAxhFx4ngxZgPbnb15hFVdWIMVyAqz oVew== X-Forwarded-Encrypted: i=1; AJvYcCWVgGY9sSeisUztgpobeKo/jpveazXGQnTUQ1Q8OqEqfcdM+AL8QD9C0BNspXM+sy2xGX46Lpm0JQAEc28=@vger.kernel.org X-Gm-Message-State: AOJu0Yyh2IPBB0xejctoTzd2uODdF5hq+4Y2nvdFNFgyOqYwgPoIGjKe KllZyjnekmx8ps+7pZPJu4Ef0oAhXMNGZ/lumZq6UL8iiceuQ8cFPxtM X-Gm-Gg: ASbGncvPeOL5ymaqjyHu6bED1uprJPBzzrAv6+4kuBW/3dNCadpX55Wd9TKwlRC457/ c5pUISAi5JcAVtle4cjSbCWkIdMmMOcn8mZ6OhWxJ7FzQcecjYApLHgeRCEN8pb2+JjSDcQ7xe3 R+syLT75vwGgxL6DapLW2qoV2TJMBIS+ItZ65NdJ3roJT2PONkNQKU4hE2+kEllVyqPjDEJGRTz TXgsy8lYadO7IdLDrO+QnNPMPuSbDC1PkNKuQf/cXr72eavlFDR5vGhP+a1JzR3t/XIvZsUCqoj 4yofSPr2u+IjFvkn7nIWCYmGTH4xhX4V18+jlBdqnqufJAQ9O5w0fIjZuG1mBXVkwtnmjS0HLst LFI2os+NALTqBSunue6+U2Hy55eidsFcy3pRJf0UGn+i0deREoHLbrLWBrDGgOTheRirVP3gttF 6SvhDis4almggb1zwZ6jPlMnhbxLl7t2/+ODKc+I9+01lFkE1QRv4RvLkkfc6yL1m31ZwZzjgct /1pa2G7Lf7RdhgZmzNr21QQzRRN41o= X-Google-Smtp-Source: AGHT+IFI9Wwvq/A5D0mlqZlN00u3cG6xT1eMWW/nCv3lLfCOJ9IihPCMHOqYjym3ZOcL+eAXbx3BBQ== X-Received: 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-kernel@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.