lkml.org 
[lkml]   [2008]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][-mm] Add an owner to the mm_struct (v4)

On Tue, 01 Apr 2008 18:13:12 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
> + /*
> + * Search in the children
> + */
> + list_for_each_entry(c, &p->children, sibling) {
> + if (c->mm == mm)
> + goto assign_new_owner;
> + }
> +
This finds new owner when "current" is multi-threaded and
"current" called pthread_create(), right ?

> + /*
> + * Search in the siblings
> + */
> + list_for_each_entry(c, &p->parent->children, sibling) {
> + if (c->mm == mm)
> + goto assign_new_owner;
> + }
> +
This finds new owner when "current" is multi-threaded and
"current" is just a child (means it doesn't call pthread_create()) ?


> + /*
> + * Search through everything else. We should not get
> + * here often
> + */
> + do_each_thread(g, c) {
> + if (c->mm == mm)
> + goto assign_new_owner;
> + } while_each_thread(g, c);

Doing above in synchronized manner seems too heavy.
When this happen ? or Can this be done in lazy "on-demand" manner ?

+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 ?

Thanks,
-Kame



\
 
 \ /
  Last update: 2008-04-02 02:31    [W:0.170 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site