diff options
author | Colin Cross <ccross@android.com> | 2010-11-23 21:37:04 -0800 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:38:25 -0800 |
commit | 55488ed10abc42e33f3997c3860e52d4dbc170af (patch) | |
tree | 03c8146e5dde061f04c7526943ed3087678e03f8 /include/linux/cgroup.h | |
parent | a300f2997a5bbba4dbab8dd1c689d5ef7521ad9a (diff) |
cgroup: Remove call to synchronize_rcu in cgroup_attach_task
synchronize_rcu can be very expensive, averaging 100 ms in
some cases. In cgroup_attach_task, it is used to prevent
a task->cgroups pointer dereferenced in an RCU read side
critical section from being invalidated, by delaying the
call to put_css_set until after an RCU grace period.
To avoid the call to synchronize_rcu, make the put_css_set
call rcu-safe by moving the deletion of the css_set links
into free_css_set_work, scheduled by the rcu callback
free_css_set_rcu.
The decrement of the cgroup refcount is no longer
synchronous with the call to put_css_set, which can result
in the cgroup refcount staying positive after the last call
to cgroup_attach_task returns. To allow the cgroup to be
deleted with cgroup_rmdir synchronously after
cgroup_attach_task, have rmdir check the refcount of all
associated css_sets. If cgroup_rmdir is called on a cgroup
for which the css_sets all have refcount zero but the
cgroup refcount is nonzero, reuse the rmdir waitqueue to
block the rmdir until free_css_set_work is called.
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'include/linux/cgroup.h')
-rw-r--r-- | include/linux/cgroup.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 50a1581e3129..ac1140066bf8 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -279,6 +279,7 @@ struct css_set { /* For RCU-protected deletion */ struct rcu_head rcu_head; + struct work_struct work; }; /* |