[PATCH v4 10/15] riscv: pgtable: move pagetable_dtor() to __tlb_remove_table()
Qi Zheng
zhengqi.arch at bytedance.com
Tue Jan 7 23:31:10 AEDT 2025
On 2025/1/7 19:58, Kevin Brodsky wrote:
> On 07/01/2025 11:51, Qi Zheng wrote:
>> [...]
>>
>> Author: Qi Zheng <zhengqi.arch at bytedance.com>
>> Date: Fri Dec 13 17:13:48 2024 +0800
>>
>> mm: pgtable: completely move pagetable_dtor() to generic
>> tlb_remove_table()
>>
>> For the generic tlb_remove_table(), it is implemented in the
>> following two
>> forms:
>>
>> 1) CONFIG_MMU_GATHER_TABLE_FREE is enabled
>>
>> tlb_remove_table
>> --> generic __tlb_remove_table()
>>
>> 2) CONFIG_MMU_GATHER_TABLE_FREE is disabled
>>
>> tlb_remove_table
>> --> tlb_remove_page
>>
>> For case 1), the pagetable_dtor() has already been moved to generic
>> __tlb_remove_table().
>>
>> For case 2), now only arm will call
>> tlb_remove_table()/tlb_remove_ptdesc()
>> when CONFIG_MMU_GATHER_TABLE_FREE is disabled. Let's move
>> pagetable_dtor()
>> completely to generic tlb_remove_table(), so that the
>> architectures can
>> follow more easily.
>>
>> Signed-off-by: Qi Zheng <zhengqi.arch at bytedance.com>
I missed your Suggested-by, will add it in v5.
>>
>> diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h
>> index b8eebdb598631..ea4fbe7b17f6f 100644
>> --- a/arch/arm/include/asm/tlb.h
>> +++ b/arch/arm/include/asm/tlb.h
>> @@ -34,10 +34,6 @@ __pte_free_tlb(struct mmu_gather *tlb, pgtable_t
>> pte, unsigned long addr)
>> {
>> struct ptdesc *ptdesc = page_ptdesc(pte);
>>
>> -#ifndef CONFIG_MMU_GATHER_TABLE_FREE
>> - pagetable_dtor(ptdesc);
>> -#endif
>
> I guess this hunk will disappear since this call isn't present to start
> with.
Yes, I plan to add this in the patch #8, and remove it in this patch.
>
>> -
>> #ifndef CONFIG_ARM_LPAE
>> /*
>> * With the classic ARM MMU, a pte page has two corresponding pmd
>> diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
>> index 69de47c7ef3c5..53ae7748f555b 100644
>> --- a/include/asm-generic/tlb.h
>> +++ b/include/asm-generic/tlb.h
>> @@ -220,14 +220,20 @@ static inline void __tlb_remove_table(void *table)
>>
>> extern void tlb_remove_table(struct mmu_gather *tlb, void *table);
>>
>> -#else /* !CONFIG_MMU_GATHER_HAVE_TABLE_FREE */
>> +#else /* !CONFIG_MMU_GATHER_TABLE_FREE */
>
> Good catch!
>
>>
>> +static inline void tlb_remove_page(struct mmu_gather *tlb, struct
>> page *page);
>
> Nit: might be better to move the declaration up, e.g. above #ifdef
> CONFIG_MMU_GATHER_TABLE_FREE.
Now only the tlb_remove_table() below calls it, maybe it's better to
keep the impact to minimum?
>
>> /*
>> * Without MMU_GATHER_TABLE_FREE the architecture is assumed to have
>> page based
>> * page directories and we can use the normal page batching to free
>> them.
>> */
>> -#define tlb_remove_table(tlb, page) tlb_remove_page((tlb), (page))
>> +static inline void tlb_remove_table(struct mmu_gather *tlb, void *table)
>> +{
>> + struct page *page = (struct page *)table;
>>
>> + pagetable_dtor(page_ptdesc(page));
>> + tlb_remove_page(tlb, page);
>> +}
>> #endif /* CONFIG_MMU_GATHER_TABLE_FREE */
>>
>> #ifdef CONFIG_MMU_GATHER_RCU_TABLE_FREE
>
> Looks good to me otherwise.
I will add your Reviewed-by to all patches (except yours) in v5, can
I also add it to this new added patch? (if we agree with the discussion
above) ;)
Thanks!
>
> - Kevin
More information about the Linuxppc-dev
mailing list