[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250219112122.GLZ7W-sjOTi-LXlRp4@fat_crate.local>
Date: Wed, 19 Feb 2025 12:21:22 +0100
From: Borislav Petkov <bp@...en8.de>
To: Rik van Riel <riel@...riel.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, peterz@...radead.org,
dave.hansen@...ux.intel.com, zhengqi.arch@...edance.com,
nadav.amit@...il.com, thomas.lendacky@....com, kernel-team@...a.com,
linux-mm@...ck.org, akpm@...ux-foundation.org, jackmanb@...gle.com,
jannh@...gle.com, mhklinux@...look.com, andrew.cooper3@...rix.com,
Dave Hansen <dave.hansen@...el.com>
Subject: Re: [PATCH v11 03/12] x86/mm: consolidate full flush threshold
decision
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@...en8.de>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists