Messages in this thread | | | Date | Wed, 2 Apr 2008 12:27:38 -0700 | From | "Paul Menage" <> | Subject | Re: [RFC][-mm] Add an owner to the mm_struct (v4) |
| |
On Tue, Apr 1, 2008 at 8:25 PM, Balbir Singh <balbir@linux.vnet.ibm.com> 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
| |