Re: [PATCH] rcu: Use cpus_read_lock() while looking at cpu_online_mask

From: Tejun Heo
Date: Wed Sep 19 2018 - 16:55:28 EST


Hello,

On Tue, Sep 11, 2018 at 10:02:22AM -0700, Paul E. McKenney wrote:
> > Doesn't work for me because it is still within the preempt-disable
> > section :/.
> > Would it work to use WORK_CPU_UNBOUND? As far as I understand it, the
> > CPU number does not matter, you just want to spread it across multiple
> > CPUs in the NUMA case.
>
> Locality is a good thing, but yes, something like this?
>
> if (!IS_ENABLED(CONFIG_PREEMPT_RT) && /* or whatever it is called */
> unlikely(cpu > rnp->grphi - rnp->grplo))
>
> Another approach that might be better longer term would be to have a
> workqueue interface that treats the specified CPU as a suggestion,
> and silently switches to WORK_CPU_UNBOUND if there is any problem
> whatsoever with the specified CPU. Tejun, Lai, thoughts?

Unbound workqueue is NUMA-affine by default, so using it by default
might not harm anything. Also, per-cpu work items get unbound from
the cpu if the cpu goes down while the work item is running or queued,
so it might just work already.

Thanks.

--
tejun