From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 4EEAB30F81F for ; Wed, 5 Nov 2025 19:25:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762370742; cv=none; b=oNE4FrotQo5SYrrnP6PWGCpwCghjuJJMCTAOAGUwe6ZDaoHdJ7dcHTJxsqsc/b3sh5X5ure6zb8NEeKe92yvDC86GqMS24R4/8yBqFOakLM08sztspFAeBG1HPw663EO7QTnyT9N6r/A5XCFMRT0fNvvcZ/uuqFDuTNXPLnCW/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762370742; c=relaxed/simple; bh=Nu03Bte3QnL2ZmTAQ8EJFRG0YuAObGrFfyjxidVrgGs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=p/ogsXm2+wj6zICJDo3SO5rjHW0c3ggZhUn0gQZjtw2Ptnd6ZwzA3TbS+MjP7hdZwKVeM9/YdfbTmLCf6/Laj522nPG2KLj0719G6zPBPFc8qSueQfFwYUjpSUP0KW+mNIILCjL86NV4xE73EVZaeOpWhw0UgAbxZcBUsvp3pi0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=HsKyD+db; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="HsKyD+db" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-8b145496cc1so22096685a.1 for ; Wed, 05 Nov 2025 11:25:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1762370739; x=1762975539; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=z3c7ISS42F3tYlBvNOZmQXpwFtE1e4tCRa3nMbV4lv0=; b=HsKyD+dbblu5fR8+XfO4QDYF3ZU96k25c0OR5LKNuo8ojUSKZDUwyc1VK1IVw5aIh4 sQye0FP2b5ay1oBbWg0HzhJTNlDvYyWqm4PY6CYN5fk+JMKmstLH3AarRKSdzK/KfHfV fRtvhSmQ/ppueWx8O/OKrHcQBTkE9Sh7OiSXd8dB8VV/7WnJJ3M1ip1F0FoauUNesHNU NNjhxsRXmUbzqsCFzhec+11IuhUQDpLY+Jo8HzLKUk5vaHIzZJzY91iScXWWOeROi3mo bw5KGFMf+w8cwElcAKOVYS7jUkRg5KDpkHXrC6OMVtHTCBVYNujMi5b+hVTfhvdU27JV pIFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762370739; x=1762975539; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=z3c7ISS42F3tYlBvNOZmQXpwFtE1e4tCRa3nMbV4lv0=; b=uNrA/CuxOJ8biNsjbDbjMvQ5iQ+vOGQGWLLcGWcphAp4TlrDg2r8XWiLDuvPSVujWN aOymXQ8QBBfnyzSRiGG3NggDti7qUqpjoMZN7LnVhN66aiXt/5GPyX3MN6ixLDyAris0 bWtbIH1euLtWAu03p1oQRf6f/NhAk+Dxc7R0oY4zgGk1SvoR8PQ7y5tacKKvc6mQKbtj PyGSk+tBF6aZpNuuR41UtTr2Axj0spBmekRc72sepbyPTcKgpOtSdL356y9MSSKW5MMa TjhC7i44sgdKrInw4S1m8tC656dyQ3DlyT8cpyBlBDS/394iwE2FWMPQu6xvyFQGS1I8 Mu/A== X-Forwarded-Encrypted: i=1; AJvYcCWKr+tA241LxtWqQJ9TPBRwve8TtSUrMJf5mTdrrBqGO3Ca1nCMYrNupd1BBucOem0p9hrrXA41TZ4P@vger.kernel.org X-Gm-Message-State: AOJu0YxbGcfkPeuMXFco/H5MYqk6v04LhIYDTqg3V5S0vpnFHp8dQkhf 9IdzdSispHgUXVT/mvLVDjGZMObZ0Q2OnU0udshwar2Woagh+yIBIM6Vs/Yt/tDNgVs= X-Gm-Gg: ASbGncvpTqq6ho8tWOKFAobeO3Ga0uVCLqVnM++4n9jwBNzkaANM0LLisKhRBFsThy4 m1H9pwZBEzSIKXTxk7UyVbw8yV1O1pkCM67WXt0GZw1Re/fgjWH+1VTgVBwA4D/vuV6TzQ212fw QL5CQl/k/pVQlPDYshW28ncqhqnZWi6AO0Mg9lOoDarZJAt/q/LVdC6+xGNcavD+UX635yKkWQd /lvDU+c4qfRZmLpxul2eQlI+EPdpXLjTj0iN6l38vehCfvxQuk9V8bpw6TC9WBCMKWdvflz9duF CgUg5/z3YY5NT9NBl0jvtMRd/GNk5ZShrtYuTihDkPylleoNfkPd1OkYpCF2PTOrhpW4LbxsShP Oaoen6+dsHhPscKd7qVozwfUi91JmgOq+4Ee9hGp1WsgzWtiRvjrIgRG2JfTp7Blxl/9bxRM6/k a0DSBCBqhEoPfyKAu+LvcUSFRto4WnuJzIBe46QPJ2wCziPOgCy4eYuzyTwZ0= X-Google-Smtp-Source: AGHT+IE93lZWq2OeBwVItF8pvYDXcfH6WZ0IIQ5p6JNn6wR82KcxAzEptz788KT3rDLJ0XOoUhNeCw== X-Received: by 2002:a05:620a:4887:b0:8b1:a624:17b1 with SMTP id af79cd13be357-8b220b03a22mr560424085a.27.1762370739005; Wed, 05 Nov 2025 11:25:39 -0800 (PST) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b2355e7208sm27162885a.18.2025.11.05.11.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Nov 2025 11:25:38 -0800 (PST) Date: Wed, 5 Nov 2025 14:25:34 -0500 From: Gregory Price To: Matthew Wilcox Cc: Lorenzo Stoakes , Andrew Morton , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , 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 Subject: Re: [PATCH 02/16] mm: introduce leaf entry type and use to simplify leaf entry logic Message-ID: References: <2c75a316f1b91a502fad718de9b1bb151aafe717.1762171281.git.lorenzo.stoakes@oracle.com> Precedence: bulk X-Mailing-List: linux-arch@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: On Wed, Nov 05, 2025 at 07:06:11PM +0000, Matthew Wilcox wrote: > On Mon, Nov 03, 2025 at 12:31:43PM +0000, Lorenzo Stoakes wrote: > > The kernel maintains leaf page table entries which contain either: > > > > - Nothing ('none' entries) > > - Present entries (that is stuff the hardware can navigate without fault) > > - Everything else that will cause a fault which the kernel handles > > The problem is that we're already using 'pmd leaf entries' to mean "this > is a pointer to a PMD entry rather than a table of PTEs". Having not looked at the implications of this for leafent_t prototypes ... Can't this be solved by just adding a leafent type "Pointer" which implies there's exactly one leaf-ent type which won't cause faults? is_present() => (table_ptr || leafent_ptr) else(): => !leafent_ptr if is_none() do the none-thing if is_present() if is_leafent(ent) (== is_leafent_ptr) do the pointer thing else do the table thing else() type = leafent_type(ent) switch(type) do the software things can't be a present entry (see above) A leaf is a leaf :shrug: ~Gregory