lkml.org 
[lkml]   [2019]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 1/9] smp: Run functions concurrently in smp_call_function_many()
On Fri, Jul 19, 2019 at 11:23:06AM -0700, Dave Hansen wrote:
> On 7/18/19 5:58 PM, Nadav Amit wrote:
> > @@ -624,16 +622,11 @@ EXPORT_SYMBOL(on_each_cpu);
> > void on_each_cpu_mask(const struct cpumask *mask, smp_call_func_t func,
> > void *info, bool wait)
> > {
> > - int cpu = get_cpu();
> > + preempt_disable();
> >
> > - smp_call_function_many(mask, func, info, wait);
> > - if (cpumask_test_cpu(cpu, mask)) {
> > - unsigned long flags;
> > - local_irq_save(flags);
> > - func(info);
> > - local_irq_restore(flags);
> > - }
> > - put_cpu();
> > + __smp_call_function_many(mask, func, func, info, wait);
> > +
> > + preempt_enable();
> > }
>
> The get_cpu() was missing it too, but it would be nice to add some
> comments about why preempt needs to be off. I was also thinking it
> might make sense to do:
>
> cfd = get_cpu_var(cfd_data);
> __smp_call_function_many(cfd, ...);
> put_cpu_var(cfd_data);
>
> instead of the explicit preempt_enable/disable(), but I don't feel too
> strongly about it.

It is also required for cpu hotplug.

\
 
 \ /
  Last update: 2019-07-22 20:17    [W:0.099 / U:0.580 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site