diff options
author | Colin Cross <ccross@android.com> | 2010-11-23 21:37:04 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2012-04-09 13:53:12 -0700 |
commit | befae2f2c9137d6af5c8b38670f00441019032bb (patch) | |
tree | 5ce3739615c8c9798671af88aa9d3124e720a7d0 /include | |
parent | 4a12178d3dd5b06a215076c60dc7cb124d711373 (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>
Conflicts:
kernel/cgroup.c
Change-Id: I3b3f245c8f5e2e5d33f1e54178b2bb6ef10a0817
Diffstat (limited to 'include')
-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 a2ed0cd0ab7..b2a37357556 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -247,6 +247,7 @@ struct css_set { /* For RCU-protected deletion */ struct rcu_head rcu_head; + struct work_struct work; }; /* |