Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (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 6336B2C236D for ; Wed, 5 Nov 2025 21:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762378162; cv=none; b=gJ5zidp0gsUsSraME6In6oBgPjYRjdm6j4T34JV9RKo3ZV61Tdb9WAjYqJK0ynVlvimMLUHb2zucwhVPswwuheh19Mpzpkt6Vue0841y5D2gd/ijp10i9c1VFg7iMDOuX6ARH0pc+ucdgWoZHzV/BWJoW/JZHMBOKBUGdn451bw= 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=bfu0AT6T; arc=none smtp.client-ip=209.85.221.52 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="bfu0AT6T" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-4283be7df63so146723f8f.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=lists.linux.dev; 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=bfu0AT6TbvdSXUvZq2dLLXZfcX1DKqWWHZeYkHNTkmiAT+1sebWfKF+3+ZnUoWyeDx JaCvou/b2qBa/qwszXY6hMpt8ykUwdfIIHZJ7mDLm0SVIPfXbXKoLY/XKg8k73dDXXwx Rcjxs68QHJKrX7HgA0oOSjcdVPJp7ARk/jxFnNZ6Rm/WHKO7+1m2Um6De7xtkxrPbATN Ik2BL7V1QnkP4F1pKC9SXItY8j00yjiIuFxnJX0b6iX3JmtXubEsSCP5GSmayUWBxoyC idhBq7LkTX1/OhTEL9fj/VVNpXJCA22BYNyZzBJFrlFmOHnUkVVVVXiK1JIbTTd4v5AS U5ZA== 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=lYbFShX9zxbPm8JBs7246ax6GIesjCKJ8im7tWeSdP+TO7Vr2xH2GTvmvhhdkk/mPW scOpPuMVD/4lwZVwD6ljgwW6lHmTWRnhC+SnR4Ng2PV42db+FPLChK51NY1LPxV0wUlv qSkShqSmJ2srFEDWrZpDMH5gGny9MLf6wzmcriTAfqGbAekMmeUJTHHM+zJ02NZRhsOp zARMMAlcY1+DQHE5GOTQ6ZcmIlbAQP7KxHPsVX815QTgEcyBgH+1V/ir3EK/+TxKMNBt ZHruMNzwuYChvKJX7EUuktqf5UtFKWK5M2YhrTDLhzoONjsnccXp54cJY+mDZOqiGmlj U/zQ== X-Forwarded-Encrypted: i=1; AJvYcCVzsD8eB5vOFy+1bSTsqQEHBDcTUuhcmXV6FzIr3gvP0qImcvaiDGO5f4ceURltTeBsk+HZrg==@lists.linux.dev X-Gm-Message-State: AOJu0YzUWSofJcSBoPIVXY5fjJOuheyPsk5CIXEzh/YYNPbK88mm/Lyd pyulBujSD2/AlH1hHHmZXQmgaZTcbODx2lDvLnnrFLxwm8ukyXbT8DL6 X-Gm-Gg: ASbGncvZ5HW7fq7/0CGyeJ4pSwsrOpL0xuXcmQYRSpqpOp6D6BIuWQ2RgkTOtshxE1a addZij5tjyCHqmWoQvV0HxpD0xTTSyokn0MfEtYJ4+YbpwtwTlBUO9T36No+AqSzmXTm+IXr0Dh wAX9aY6uJSMU3p9DcIm6WERzu/3pEEn4EDCYuNX9FVH/YqxA01wsKpGlyitZ3itu6h3P1U68S0x 4eq05n9tTIbMgf6scp6dF67vNx9h5Wzvt8wHeSM7xRvYhv6SX7iHxT/I6mi5zxpwGlaA7i8IWus SquzSulV21ob0nkCC1M0itPN3OnhzJzBVMD4jiHLbPLOteZp0B/auoKJXhrJcWakv7km/MMA4ws VHpFqeQo7fclOejJ445C3ddFnf/vjpUoLSxO57outniwpIuVjqhgy2bkl0/T86JyF/KIeewhP+I iQS8ivswHbddhl9A1EFLIfGZNfkvkgRsSPIelWdumNolqzvGpejRpi6M6mCAcxx6J7N8DpSnVOz WsVTJRQ32Bu8YDXo2ay7MAj0y+SYiQ= 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: damon@lists.linux.dev 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.