Re: [PATCH v2 11/15] mm: pgtable: introduce generic __tlb_remove_table()

From: Qi Zheng
Date: Fri Dec 20 2024 - 06:31:50 EST




On 2024/12/20 19:18, Alexander Gordeev wrote:
On Wed, Dec 18, 2024 at 09:04:47PM +0800, Qi Zheng wrote:
Several architectures (arm, arm64, riscv, s390 and x86) define exactly the
same __tlb_remove_table(), just introduce generic __tlb_remove_table() to
eliminate these duplications.

s390 is nearly the same, but not exactly (see below).

arch/s390/include/asm/tlb.h | 1 -
arch/s390/mm/pgalloc.c | 7 -------
...
--- a/arch/s390/mm/pgalloc.c
+++ b/arch/s390/mm/pgalloc.c
@@ -193,13 +193,6 @@ void page_table_free(struct mm_struct *mm, unsigned long *table)
pagetable_dtor_free(ptdesc);
}
-void __tlb_remove_table(void *table)
-{
- struct ptdesc *ptdesc = virt_to_ptdesc(table);
-
- pagetable_dtor_free(ptdesc);

With this change you introduce these duplication in __tlb_remove_table()
and in pagetable_dtor_free():

pagetable_dtor(ptdesc);
pagetable_free(ptdesc);

But I still would prefer to avoid __HAVE_ARCH_TLB_REMOVE_TABLE.
Could it be possible to move pagetable_dtor_free() to asm-generic and
make s390 __tlb_remove_table() version generic?

Yes, see my reply to Peter below:

https://lore.kernel.org/lkml/3f9a5475-930d-4f45-8fc8-8d2e8a6a08cc@xxxxxxxxxxxxx/

I will do it in v3. And I have make pagetable_dtor_free() generic in [PATCH v2 15/15].


-}
-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
static void pte_free_now(struct rcu_head *head)
{

Thanks!