Re: [PATCH 14/22] mm: set page table page type when allocated
Kevin Brodsky <[email protected]> Fri, 24 Jul 2026 18:31:32 +0200
| Newsgroups | org.kernel.vger.linux-efi,dev.linux.lists.loongarch,org.infradead.lists.linux-riscv,org.infradead.lists.linux-um,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-parisc,org.kernel.vger.linux-s390,org.kernel.vger.sparclinux,org.kvack.linux-mm,org.ozlabs.lists.linuxppc-dev |
|---|---|
| Message-ID | <[email protected]> |
On 20/07/2026 21:05, Vishal Moola wrote: > On Thu, Jul 16, 2026 at 11:49:31AM +0200, Kevin Brodsky wrote: >>> 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. Ah got it, that makes sense. > > 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). Right, that should be fine - calling pagetable_free() on anything else than a ptdesc allocated by pagetable_alloc() is a bug, so if we get any crash because of this we should just go and fix the underlying issue. I'd still switch to __SetPagePgtable() in a separate commit to improve bisectability. FWIW there are definitely cases where pagetable_free() and pagetable_alloc() calls aren't properly matched (see my reply to the cover letter), this needs to be addressed for this series anyway. > We can say thats a happy accident that makes distinguishing ptdescs > and folios easier :) Indeed! - Kevin