From: Alex Shi <seakeel@gmail.com>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
alexs@kernel.org, Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
"David S . Miller" <davem@davemloft.net>,
Andreas Larsson <andreas@gaisler.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R . Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
Matthew Brost <matthew.brost@intel.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
Gregory Price <gourry@gourry.net>,
Ying Huang <ying.huang@linux.alibaba.com>,
Alistair Popple <apopple@nvidia.com>,
Thomas Huth <thuth@redhat.com>, Will Deacon <will@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Magnus Lindholm <linmag7@gmail.com>,
linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org,
sparclinux@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [RFC PATCH 1/2] mm/pgtable: use ptdesc for pmd_huge_pte
Date: Mon, 15 Dec 2025 22:26:42 +0800 [thread overview]
Message-ID: <b9e3921a-2a54-4adb-b19c-802e2aa1aa75@gmail.com> (raw)
In-Reply-To: <686b85ff-6a5a-4608-af97-55aee1582c5c@kernel.org>
On 2025/12/15 14:06, Christophe Leroy (CS GROUP) wrote:
>
> Le 14/12/2025 à 07:55, alexs@kernel.org a écrit :
>> From: Alex Shi <alexs@kernel.org>
>>
>> 'pmd_huge_pte' are pgtable variables, but used 'pgtable->lru'
>> instead of pgtable->pt_list in pgtable_trans_huge_deposit/withdraw
>> functions, That's a bit weird.
>>
>> So let's convert the pgtable_t to precise 'struct ptdesc *' for
>> ptdesc->pmd_huge_pte, and mm->pmd_huge_pte, then convert function
>> pgtable_trans_huge_deposit() to use correct ptdesc.
>>
>> This convertion works for most of arch, but failed on s390/sparc/powerpc
>> since they use 'pte_t *' as pgtable_t. Is there any suggestion for these
>> archs? If we could have a solution, we may remove the pgtable_t for other
>> archs.
>
> The use of struct ptdesc * assumes that a pagetable is contained in one
> (or several) page(s).
>
> On powerpc, there can be several page tables in one page. For instance,
> on powerpc 8xx the hardware require page tables to be 4k at all time,
> allthough page sizes can be either 4k or 16k. So in the 16k case there
> are 4 pages tables in one page.
Hi Christophe,
Thanks a lot for the info.
>
> There is some logic in arch/powerpc/mm/pgtable-frag.c to handle that but
> this is only for last levels (PTs and PMDs). For other levels
> kmem_cache_alloc() is used to provide a PxD of the right size. Maybe the
> solution is to convert all levels to using pgtable-frag, but this
> doesn't look trivial. Probably it should be done at core level not at
> arch level.
Uh, glad to hear some idea for this, would you like to give more
detailed explanation of your ideas?
Thanks a lot
>
> Christophe
>
>>
>> Signed-off-by: Alex Shi <alexs@kernel.org>
>> ---
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/
>> powerpc/include/asm/book3s/64/pgtable.h
>> index aac8ce30cd3b..f10736af296d 100644
>> --- a/arch/powerpc/include/asm/book3s/64/pgtable.h
>> +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h
>> @@ -1320,11 +1320,11 @@ pud_t pudp_huge_get_and_clear_full(struct
>> vm_area_struct *vma,
>> #define __HAVE_ARCH_PGTABLE_DEPOSIT
>> static inline void pgtable_trans_huge_deposit(struct mm_struct *mm,
>> - pmd_t *pmdp, pgtable_t pgtable)
>> + pmd_t *pmdp, struct ptdesc *pgtable)
>> {
>> if (radix_enabled())
>> - return radix__pgtable_trans_huge_deposit(mm, pmdp, pgtable);
>> - return hash__pgtable_trans_huge_deposit(mm, pmdp, pgtable);
>> + return radix__pgtable_trans_huge_deposit(mm, pmdp,
>> page_ptdesc(pgtable));
>> + return hash__pgtable_trans_huge_deposit(mm, pmdp,
>> page_ptdesc(pgtable));
>> }
>
> I can't understand this change.
>
> pgtable is a pointer to a page table, and you want to replace it to
> something that returns a pointer to a struct page, how can it work ?
Sorry for the bothering. Right, it can't work as I mentioned in commit
log. I just want to bring up this issue, and hope you expert to give
some ideas.
Thanks
prev parent reply other threads:[~2025-12-15 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-14 6:55 alexs
2025-12-14 6:55 ` [RFC PATCH 2/2] mm/pgtable: convert pgtable_trans_huge_withdraw to ptdesc alexs
2025-12-15 0:53 ` [RFC PATCH 1/2] mm/pgtable: use ptdesc for pmd_huge_pte Alex Shi
2025-12-18 10:01 ` David Hildenbrand (Red Hat)
2025-12-18 14:16 ` Alex Shi
2025-12-15 6:06 ` Christophe Leroy (CS GROUP)
2025-12-15 14:26 ` Alex Shi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b9e3921a-2a54-4adb-b19c-802e2aa1aa75@gmail.com \
--to=seakeel@gmail.com \
--cc=Liam.Howlett@oracle.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=andreas@gaisler.com \
--cc=apopple@nvidia.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=borntraeger@linux.ibm.com \
--cc=byungchul@sk.com \
--cc=chleroy@kernel.org \
--cc=davem@davemloft.net \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=gourry@gourry.net \
--cc=hca@linux.ibm.com \
--cc=joshua.hahnjy@gmail.com \
--cc=lance.yang@linux.dev \
--cc=linmag7@gmail.com \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=maddy@linux.ibm.com \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=mpe@ellerman.id.au \
--cc=npache@redhat.com \
--cc=npiggin@gmail.com \
--cc=rakie.kim@sk.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=sparclinux@vger.kernel.org \
--cc=surenb@google.com \
--cc=svens@linux.ibm.com \
--cc=thuth@redhat.com \
--cc=vbabka@suse.cz \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox