Re: [RFC][-mm] Add an owner to the mm_struct (v4)

From: Paul Menage
Date: Wed Apr 02 2008 - 15:28:30 EST


On Tue, Apr 1, 2008 at 8:25 PM, Balbir Singh <balbir@xxxxxxxxxxxxxxxxxx> wrote:
>
> > +assign_new_owner:
> > + rcu_read_unlock();
> > + BUG_ON(c == p);
> > + task_lock(c);
> > + if (c->mm != mm) {
> > + task_unlock(c);
> > + goto retry;
> > + }
> > + cgroup_mm_owner_callbacks(mm->owner, c);
> > + mm->owner = c;
> > + task_unlock(c);
> > +}
> > Why rcu_read_unlock() before changing owner ? Is it safe ?
> >
>
> It should be safe, since we take task_lock(), but to be doubly sure, we can drop
> rcu read lock after taking the task_lock().
>

I agree with Kamezawa - the task can technically disappear as soon as
we leave the RCU critical section. (In practice, it'll only happen
with CONFIG_PREEMPT).

Paul
--
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/