Re: [RFC PATCH 00/18] use struct ptdesc to replace pgtable_t

Matthew Wilcox
2024-08-14T17:13:25Z

On Tue, Jul 30, 2024 at 02:46:54PM +0800, alexs@kernel.org wrote:
> We have struct ptdesc for page table descriptor a year ago, but it
> has no much usages in kernel, while pgtable_t is used widely.

Hum, I thought I responded to this to point out the problem, but
I don't see the response anywhere, so I'll try again.

> The pgtable_t is typedefed as 'pte_t *' in sparc, s390, powerpc and m68k
> except SUN3, others archs are all same as 'struct page *'.

And there's a very good reason for that. On s390 and powerpc (I cannot
speak to the sparc/m68k), each page table is (potentially) smaller
than PAGE_SIZE. So we cannot do what your patch purports to do, as
we would not know whether we're referring to the first or subsequent
page tables contained within a page.

Maybe at some point in the distant future we'll be able to allocate
a ptdesc per page table instead of per page allocated for use by page
tables. But we cannot do that yet.