Re: [PATCH v11 03/12] x86/mm: consolidate full flush threshold decision

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 13, 2025 at 11:13:54AM -0500, Rik van Riel wrote:
> @@ -1009,6 +1009,15 @@ static struct flush_tlb_info *get_flush_tlb_info(struct mm_struct *mm,
>  	info->initiating_cpu	= smp_processor_id();
>  	info->trim_cpumask	= 0;
>  
> +	/*
> +	 * If the number of flushes is so large that a full flush
> +	 * would be faster, do a full flush.
> +	 */
> +	if ((end - start) >> stride_shift > tlb_single_page_flush_ceiling) {
> +		info->start = 0;
> +		info->end = TLB_FLUSH_ALL;
> +	}

And if you move the range decision before the info-> struct members
assignment, it becomes even more readable because you're using start and end
in the check and then you assign it so a reader doesn't have to go and look
whether start and end are the same as info->start and info->end:

        /*
         * If the number of flushes is so large that a full flush
         * would be faster, do a full flush.
         */
        if ((end - start) >> stride_shift > tlb_single_page_flush_ceiling) {
                start = 0;
                end = TLB_FLUSH_ALL;
        }

        info->start             = start;
        info->end               = end;
        info->mm                = mm;
        info->stride_shift      = stride_shift;
        info->freed_tables      = freed_tables;
        info->new_tlb_gen       = new_tlb_gen;
        info->initiating_cpu    = smp_processor_id();
        info->trim_cpumask      = 0;

        return info;
}

with that:

Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux