Re: getting processor numbers

From: Ingo Molnar
Date: Wed Apr 04 2007 - 06:02:41 EST



* Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> On 04/04, Ingo Molnar wrote:
> >
> > * Oleg Nesterov <oleg@xxxxxxxxxx> wrote:
> >
> > > But we don't need tasklist_lock at all, we can use
> > > rcu_read_lock/unlock. Q: don't we need task_rq_lock() to read
> > > ->cpus_allowed "atomically" ?
> >
> > right now ->cpus_allowed is protected by tasklist_lock. We cannot do
> > RCU here because ->cpus_allowed modifications are not RCUified.
>
> Is it so? that was my question. Afaics, set_cpus_allowed() does
> p->cpus_allowed = new_mask under rq->lock, so I don't understand how
> tasklist_lock can help.

you are right, we could (and should) make this depend on rq_lock only -
i.e. just take away the tasklist_lock like your patch does. It's not
like the user could expect to observe any ordering between PID lookup
and affinity-mask changes. And my RCU comment is bogus: it's not like we
allocate ->cpus_allowed :-/

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/