Re: [PATCH v3 tip/core/rcu 1/9] rcu: Add call_rcu_tasks()

Paul E. McKenney
2014-08-02T22:58:06Z

On Sat, Aug 02, 2014 at 04:56:16PM +0200, Oleg Nesterov wrote:
> On 07/31, Paul E. McKenney wrote:
> >
> > + rcu_read_lock();
> > + for_each_process_thread(g, t) {
> > + if (t != current && ACCESS_ONCE(t->on_rq) &&
> > + !is_idle_task(t)) {
>
> I didn't notice this check before, but it is not needed. for_each_process()
> can see the idle threads, there are not on process/thread lists.

Good to know. Any other important tasks I am missing?

I am guessing that I need to do something like this:

for_each_process(g) {
/* Do build step. */
for_each_thread(g, t) {
if (g == t)
continue;
/* Do build step. */
}
}

Or is there a better way to handle this?

> But this doesn't really matter, the main problem is that I still think that
> for_each_process_thread() can't really work anyway.

Your point about exiting tasks I get, and I believe I can solve it.
I am hoping that the above sort of construction takes care of the
idle threads. I might also need to do something to handle changes in
process/thread hierarchy -- but hopefully without having to read-acquire
the task-list lock.

So what else am I missing?

Thanx, Paul