From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 8122937E5FD for ; Mon, 20 Jul 2026 19:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784574315; cv=none; b=anqP9tvYXBuvEIVWLgZsiWmeyFG5m9zMVh3pNm0hi6NjPQHIppE1RbF24M0RTQiGhOOm1d3W0PgWcWM/8uzzUkmQRCcwAA64BPwDe3IDW54uv5lj5nw5csTLhD2MgfMCDmH5FPGw4MFmMaoe4ctQIfbvA55SXQ3HAPYsUtmn1nk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784574315; c=relaxed/simple; bh=fnW288skhTtWEbrTN/fD9Nt9dtFSRpG2InOVP3xSzZg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GrxR19dspSbdjHkf07luPj6KoUC6O/DFOufgcnA/t1afPsgQSLmKYUUCvHlvQyQ/AFhigpAkRJGTzUTxwQL9QAJgRbxgP0LLR6xScPIW9yJ1HbtzNCMapC7tD2ILJDCmdK2NTxcfDhUmO5XDpkAvjPiTn2ueixGcBZMIL43+P/A= 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=nChhInmW; arc=none smtp.client-ip=209.85.214.176 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="nChhInmW" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2cc7e86e7aeso77530655ad.2 for ; Mon, 20 Jul 2026 12:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784574313; x=1785179113; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=kPMaiKQm/Lrn2+15jJw1Tz84+egEdnjBHflNkHpDaxg=; b=nChhInmWd9vFvicDaYvJi7AlvuqkJL6hIRj/Uvakv/u5sAhVsWnIfiVqJENsJaVtvX uWbxu3sOX5gMGmWdTz6JwWWLJz65bN5TBJAGKp405KsR9TgL5G+AV/a5rN3HaL5dBLHu TUqdrIqPsUs4GjjEMx7B8tqgegC/QQmtAEkT1ufH/X8+d62Kw6AOV1pCC0Pza95Jh+aK dxpuOisj7zwAwivevu40Nw8IU1vZKxOOy19nfltq3ti1TI+n4xGtEhu1fE9vSXD5hhRf 9E9w2kYZwiJrwn2eDMRiluNfypD4i8qYAk3eahfCPi0J15dyp+hwGy4RxMabgO0befjY TIeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784574313; x=1785179113; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kPMaiKQm/Lrn2+15jJw1Tz84+egEdnjBHflNkHpDaxg=; b=PCFWWReUrfhrQ0SfspcxVpRmE8UTzuU8zl52LiO8D7ZvG8uld2aORj2g8cgRlYTv6i 1Lez1Q5ogacrwxo5NCbkHdmvnD70pY8FzcmLggX1zQeSqiOubmI7OdXanZJTwWC+SxhD 8XNLAegQJotN96apbbtf2kDMbuaI6A6KqtIIcsxlvq6idh5s0/W/9h5n//ibT+PYUyjE pYJOBM8S8hnrQt1QkjZJMsTPWjMZ3asLpJy5fyTLZ6ixWxWx/LJqNezFYB5+d7rMRh8D jbRbLNph0SXajRpc2peNn8FKD7t/w7nancmqz3+zyo1LsAG9mn3OdZXo648huoYOU8jt gZGA== X-Forwarded-Encrypted: i=1; AHgh+Rprly5K0IyS9CJ5Ht3fchILUd1zm/NoA1HbsLqzbDDG4GAMIMf6PUVKC7TUpzUg3w4g9TrnF3GREr8=@lists.linux.dev X-Gm-Message-State: AOJu0Yzmqkwvt7Ze2biSh+4gcLIiGmFJ2EunfD2LFwb+crPOmgbyhl/e LlillClSNMl2oBHNZHEkGV5fr6GRym+BjfsIaEmLJ27Zis7yq05uZ9cm X-Gm-Gg: AR+sD13754SxdPTEAr6yKNtgO3DPFN1znMq3L8vv6PwScw1gr6BMfqjInNDflX7rHqt aoLx9kjUurqggbfjqmbnO3LAynlmp7HCqWZrzPi7vizZkX9a1b1XEL3kk5kp4l2EijVLsUAwbdf axBQ9dQiyFq7U29ZcFj/C8ujuyeAuKtV5vbxM+3WsmrkehkKzzqAB4bpV5owlXKkCbPQiMY/n4Q /S4T7cqbDIcsfEascd54SWFo9NQDk24S/5OBAknjvwpMDL7kTXqHt5aIPnqx7x56GbGR9Yo6FUC zE7hPWZ43vv2BACzH+++i12AFdMHkEnRDMT+E/REA6DP7J0w3Wa26Y9Tt6askYtmv1Jm67p29f7 C+1uXVATcC1OhBHgIXkUwlOMG0Io6Dw2vrc/loGJw5uZBFVkKR+g1qm694aEgspJCKfJqhtM8/w F3PQdDg2ESY4Q6LoQd0aAJS02oM1Ha51e9aA== X-Received: by 2002:a17:902:f681:b0:2ca:3e3f:4956 with SMTP id d9443c01a7336-2cf34a35445mr164591015ad.44.1784574312756; Mon, 20 Jul 2026 12:05:12 -0700 (PDT) Received: from fedora ([2601:644:937c:6c90:6d4e:7b2d:4a39:fb0c]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf3448f73esm60735085ad.16.2026.07.20.12.05.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 12:05:11 -0700 (PDT) Date: Mon, 20 Jul 2026 12:05:08 -0700 From: Vishal Moola To: Kevin Brodsky Cc: linux-mm@kvack.org, Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Pasha Tatashin , Russell King , Catalin Marinas , Will Deacon , Ryan Roberts , linux-arm-kernel@lists.infradead.org, Huacai Chen , loongarch@lists.linux.dev, "James E.J. Bottomley" , Helge Deller , linux-parisc@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , linuxppc-dev@lists.ozlabs.org, Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Gerald Schaefer , linux-s390@vger.kernel.org, "David S. Miller" , Andreas Larsson , sparclinux@vger.kernel.org, Richard Weinberger , Anton Ivanov , Johannes Berg , linux-um@lists.infradead.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Ning Sun , x86@kernel.org, tboot-devel@lists.sourceforge.net, Ard Biesheuvel , Ilias Apalodimas , linux-efi@vger.kernel.org, Alistair Popple , "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH 14/22] mm: set page table page type when allocated Message-ID: References: <20260714-remove_pgtable_cdtor-v1-0-44be8a7685d7@arm.com> <20260714-remove_pgtable_cdtor-v1-14-44be8a7685d7@arm.com> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Thu, Jul 16, 2026 at 11:49:31AM +0200, Kevin Brodsky wrote: > On 14/07/2026 17:16, Vishal Moola wrote: > > On Tue, Jul 14, 2026 at 03:04:03PM +0100, Kevin Brodsky wrote: > >> As a step towards removing pagetable ctor/dtor calls for kernel > >> mm's, move the page type updates from the ctor/dtor to > >> pagetable_{alloc,free}. > > Thanks for doing this patchset. > > Thanks for suggesting it :) It's turning out to be quite a bit more > involved than I expected though! (There are multiple cases where we call > the ctor/dtor without using pagetable_{alloc,free}, see my reply to the > cover letter.) > > > We should switch over from __folio_set_pgtable() to __SetPagePgtable() > > in this patch. Ptdescs and folios should be treated as distinctly > > independent of each other. > > I sure remember the previous discussion, but my reading of your comments > [1] is that we cannot really change this as long as pagetable_alloc() > can be called with order > 0, right? Multiple archs still rely on that. Kinda... The concern was about callers accessing tail pages directly for that information. Using the folio API ensures that we always look into the head page. Since we're now doing it at allocation time, we know we always have the head page, so it's fine. The dtor/free should be more questionable because the underlying api uses virt_to_page() which could look at a tail page... oopsie. I haven't seen any reports tied to it so its probably fine (the setting/clearing has been using the folio API since ptdescs). We can say thats a happy accident that makes distinguishing ptdescs and folios easier :) > > Eventually, we want to replace the memcg accounting as well, but > > there's no existing API for that right now. Lets leave that as is for > > now; this patchset is big enough already ;) > > Yep, looks like there was an attempt to improve this but it had to be > reverted [2]. > > - Kevin > > [1] https://lore.kernel.org/all/aha321ndGSdReBJR@fedora/ > [2] > https://lore.kernel.org/all/20260225002434.2953895-1-axelrasmussen@google.com/ >