On Wed, Apr 12, 2017 at 10:07:28PM +0200, Thomas Gleixner wrote:
> +long work_on_cpu_safe(int cpu, long (*fn)(void *), void *arg)
> +{
> +     long ret = -ENODEV;
> +
> +     get_online_cpus();
> +     if (cpu_online(cpu))
> +             ret = work_on_cpu(cpu, fn, arg);
> +     put_online_cpus();
> +     return ret;
> +}

But doesn't workqueue have this lovelt 'feature' where it will unbind
per-cpu work and run it on random CPUs when hotplug happens?

That is, I think you need a flush_work() before put_online_cpus() if you
want to guarantee anything.

Reply via email to