On Fri, 2018-06-29 at 10:29 -0400, Rik van Riel wrote:
> diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
> index e59214ec52b1..c4073367219d 100644
> --- a/arch/x86/mm/tlb.c
> +++ b/arch/x86/mm/tlb.c
> @@ -718,14 +718,47 @@ void tlb_flush_remove_tables_local(void *arg)
>       }
>  }
>  
> +static void mm_fill_lazy_tlb_cpu_mask(struct mm_struct *mm,
> +                                   struct cpumask* lazy_cpus)
> +{
> +     int cpu;
> +
> +     for_each_cpu(cpu, mm_cpumask(mm)) {
> +             if (!per_cpu(cpu_tlbstate.is_lazy, cpu))
> +                     cpumask_set_cpu(cpu, lazy_cpus);
> +     }
> +}
> +
>  void tlb_flush_remove_tables(struct mm_struct *mm)
>  {
>       int cpu = get_cpu();
> +     cpumask_var_t lazy_cpus;
> +
> +     if (cpumask_any_but(mm_cpumask(mm), cpu) >= nr_cpu_ids)
> +             return;

A put_cpu() went missing.

> +
> +     if (!zalloc_cpumask_var(&lazy_cpus, GFP_ATOMIC)) {
> +             /*
> +              * If the cpumask allocation fails, do a brute force flush
> +              * on all the CPUs that have this mm loaded.
> +              */
> +             smp_call_function_many(mm_cpumask(mm),
> +                             tlb_flush_remove_tables_local, (void *)mm, 1);
> +             return;
> +     }

Ditto.

        -Mike

Reply via email to