diff options
author | Matt Helsley <matthltc@us.ibm.com> | 2010-05-10 17:18:47 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2010-05-10 17:18:47 -0400 |
commit | 8f77578cc2debaeb30a4ef6206f4ba10944bdcd8 (patch) | |
tree | 796fdc066d523a9827a5aec0ae4276710fb8181b /kernel/cgroup_freezer.c | |
parent | 543f2503a956601dd490c6cde0ebf6adb4653e50 (diff) |
Freezer / cgroup freezer: Update stale locking comments
Update stale comments regarding locking order and add a little more detail
so it's easier to follow the locking between the cgroup freezer and the
power management freezer code.
Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'kernel/cgroup_freezer.c')
-rw-r--r-- | kernel/cgroup_freezer.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/kernel/cgroup_freezer.c b/kernel/cgroup_freezer.c index e5c0244962b0..ce71ed53e88f 100644 --- a/kernel/cgroup_freezer.c +++ b/kernel/cgroup_freezer.c | |||
@@ -89,10 +89,10 @@ struct cgroup_subsys freezer_subsys; | |||
89 | 89 | ||
90 | /* Locks taken and their ordering | 90 | /* Locks taken and their ordering |
91 | * ------------------------------ | 91 | * ------------------------------ |
92 | * css_set_lock | ||
93 | * cgroup_mutex (AKA cgroup_lock) | 92 | * cgroup_mutex (AKA cgroup_lock) |
94 | * task->alloc_lock (AKA task_lock) | ||
95 | * freezer->lock | 93 | * freezer->lock |
94 | * css_set_lock | ||
95 | * task->alloc_lock (AKA task_lock) | ||
96 | * task->sighand->siglock | 96 | * task->sighand->siglock |
97 | * | 97 | * |
98 | * cgroup code forces css_set_lock to be taken before task->alloc_lock | 98 | * cgroup code forces css_set_lock to be taken before task->alloc_lock |
@@ -100,33 +100,38 @@ struct cgroup_subsys freezer_subsys; | |||
100 | * freezer_create(), freezer_destroy(): | 100 | * freezer_create(), freezer_destroy(): |
101 | * cgroup_mutex [ by cgroup core ] | 101 | * cgroup_mutex [ by cgroup core ] |
102 | * | 102 | * |
103 | * can_attach(): | 103 | * freezer_can_attach(): |
104 | * cgroup_mutex | 104 | * cgroup_mutex (held by caller of can_attach) |
105 | * | 105 | * |
106 | * cgroup_frozen(): | 106 | * cgroup_freezing_or_frozen(): |
107 | * task->alloc_lock (to get task's cgroup) | 107 | * task->alloc_lock (to get task's cgroup) |
108 | * | 108 | * |
109 | * freezer_fork() (preserving fork() performance means can't take cgroup_mutex): | 109 | * freezer_fork() (preserving fork() performance means can't take cgroup_mutex): |
110 | * task->alloc_lock (to get task's cgroup) | ||
111 | * freezer->lock | 110 | * freezer->lock |
112 | * sighand->siglock (if the cgroup is freezing) | 111 | * sighand->siglock (if the cgroup is freezing) |
113 | * | 112 | * |
114 | * freezer_read(): | 113 | * freezer_read(): |
115 | * cgroup_mutex | 114 | * cgroup_mutex |
116 | * freezer->lock | 115 | * freezer->lock |
116 | * write_lock css_set_lock (cgroup iterator start) | ||
117 | * task->alloc_lock | ||
117 | * read_lock css_set_lock (cgroup iterator start) | 118 | * read_lock css_set_lock (cgroup iterator start) |
118 | * | 119 | * |
119 | * freezer_write() (freeze): | 120 | * freezer_write() (freeze): |
120 | * cgroup_mutex | 121 | * cgroup_mutex |
121 | * freezer->lock | 122 | * freezer->lock |
123 | * write_lock css_set_lock (cgroup iterator start) | ||
124 | * task->alloc_lock | ||
122 | * read_lock css_set_lock (cgroup iterator start) | 125 | * read_lock css_set_lock (cgroup iterator start) |
123 | * sighand->siglock | 126 | * sighand->siglock (fake signal delivery inside freeze_task()) |
124 | * | 127 | * |
125 | * freezer_write() (unfreeze): | 128 | * freezer_write() (unfreeze): |
126 | * cgroup_mutex | 129 | * cgroup_mutex |
127 | * freezer->lock | 130 | * freezer->lock |
131 | * write_lock css_set_lock (cgroup iterator start) | ||
132 | * task->alloc_lock | ||
128 | * read_lock css_set_lock (cgroup iterator start) | 133 | * read_lock css_set_lock (cgroup iterator start) |
129 | * task->alloc_lock (to prevent races with freeze_task()) | 134 | * task->alloc_lock (inside thaw_process(), prevents race with refrigerator()) |
130 | * sighand->siglock | 135 | * sighand->siglock |
131 | */ | 136 | */ |
132 | static struct cgroup_subsys_state *freezer_create(struct cgroup_subsys *ss, | 137 | static struct cgroup_subsys_state *freezer_create(struct cgroup_subsys *ss, |