2021-02-02 06:44:48

by Nicholas Piggin

[permalink] [raw]
Subject: Re: [RFC 11/20] mm/tlb: remove arch-specific tlb_start/end_vma()

Excerpts from Peter Zijlstra's message of February 1, 2021 10:09 pm:
> On Sat, Jan 30, 2021 at 04:11:23PM -0800, Nadav Amit wrote:
>
>> diff --git a/include/asm-generic/tlb.h b/include/asm-generic/tlb.h
>> index 427bfcc6cdec..b97136b7010b 100644
>> --- a/include/asm-generic/tlb.h
>> +++ b/include/asm-generic/tlb.h
>> @@ -334,8 +334,8 @@ static inline void __tlb_reset_range(struct mmu_gather *tlb)
>>
>> #ifdef CONFIG_MMU_GATHER_NO_RANGE
>>
>> -#if defined(tlb_flush) || defined(tlb_start_vma) || defined(tlb_end_vma)
>> -#error MMU_GATHER_NO_RANGE relies on default tlb_flush(), tlb_start_vma() and tlb_end_vma()
>> +#if defined(tlb_flush)
>> +#error MMU_GATHER_NO_RANGE relies on default tlb_flush()
>> #endif
>>
>> /*
>> @@ -362,10 +362,6 @@ static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vm
>>
>> #ifndef tlb_flush
>>
>> -#if defined(tlb_start_vma) || defined(tlb_end_vma)
>> -#error Default tlb_flush() relies on default tlb_start_vma() and tlb_end_vma()
>> -#endif
>
> #ifdef CONFIG_ARCH_WANT_AGGRESSIVE_TLB_FLUSH_BATCHING
> #error ....
> #endif
>
> goes here...
>
>
>> static inline void tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma)
>> {
>> if (tlb->fullmm)
>> return;
>>
>> + if (IS_ENABLED(CONFIG_ARCH_WANT_AGGRESSIVE_TLB_FLUSH_BATCHING))
>> + return;
>
> Also, can you please stick to the CONFIG_MMU_GATHER_* namespace?
>
> I also don't think AGRESSIVE_FLUSH_BATCHING quite captures what it does.
> How about:
>
> CONFIG_MMU_GATHER_NO_PER_VMA_FLUSH

Yes please, have to have descriptive names.

I didn't quite see why this was much of an improvement though. Maybe
follow up patches take advantage of it? I didn't see how they all fit
together.

Thanks,
Nick


2021-02-02 07:23:56

by Nadav Amit

[permalink] [raw]
Subject: Re: [RFC 11/20] mm/tlb: remove arch-specific tlb_start/end_vma()

> On Feb 1, 2021, at 10:41 PM, Nicholas Piggin <[email protected]> wrote:
>
> Excerpts from Peter Zijlstra's message of February 1, 2021 10:09 pm:
>> I also don't think AGRESSIVE_FLUSH_BATCHING quite captures what it does.
>> How about:
>>
>> CONFIG_MMU_GATHER_NO_PER_VMA_FLUSH
>
> Yes please, have to have descriptive names.

Point taken. I will fix it.

>
> I didn't quite see why this was much of an improvement though. Maybe
> follow up patches take advantage of it? I didn't see how they all fit
> together.

They do, but I realized as I said in other emails that I have a serious bug
in the deferred invalidation scheme.

Having said that, I think there is an advantage of having an explicit config
option instead of relying on whether tlb_end_vma is defined. For instance,
Arm does not define tlb_end_vma, and consequently it flushes the TLB after
each VMA. I suspect it is not intentional.