On 2/13/25 08:13, Rik van Riel wrote: > - if (info->end == TLB_FLUSH_ALL) > + if (broadcast_kernel_range_flush(info)) > + ; /* Fall through. */ > + else if (info->end == TLB_FLUSH_ALL) > on_each_cpu(do_flush_tlb_all, NULL, 1); > else > on_each_cpu(do_kernel_range_flush, info, 1); We've got to find a better name for broadcast_kernel_range_flush(). Because IPIs are broadcast too. The naming makes it confusing. Why would be broadcast, and then start trying IPIs that are also broadcast? This hunk really the crux of the patch and we need to make sure the semantics are crystal clear. What do folks think about something like this: /* * Try to use a hardware assist for flushing the TLB. * This is expected to be cheaper than using an IPI * to do flushes. * * Returns True if the assisted method succeeded. */ static bool assisted_kernel_range_flush(struct flush_tlb_info *info) { ... } static do_ipi_tlb_flush(...info) { if (info->end == TLB_FLUSH_ALL) on_each_cpu(do_flush_tlb_all, NULL, 1); else on_each_cpu(do_kernel_range_flush, info, 1); } Then we end up with: /* * Assisted flushes are assumed to be faster. Try * them first and fall back to IPIs if not available. */ flush_success = assisted_kernel_range_flush(info); if (!flush_success) do_ipi_tlb_flush(info); I think that's a *LOT* more clear: 1. Try assisted flush 2. If it fails fall back to an IPI-based flush