aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-11-21 15:32:25 -0500
committerTejun Heo <tj@kernel.org>2011-11-21 15:32:25 -0500
commit22b4e111fa01a1147aa562ceaf18a752a928ef4e (patch)
treef4b29f532678c72edf99bb8df3ba64d526bc8a3c /include/linux/freezer.h
parent03afed8bc296fa70186ba832c1126228bb992465 (diff)
cgroup_freezer: prepare for removal of TIF_FREEZE
TIF_FREEZE will be removed soon and freezing() will directly test whether any freezing condition is in effect. Make the following changes in preparation. * Rename cgroup_freezing_or_frozen() to cgroup_freezing() and make it return bool. * Make cgroup_freezing() access task_freezer() under rcu read lock instead of task_lock(). This makes the state dereferencing racy against task moving to another cgroup; however, it was already racy without this change as ->state dereference wasn't synchronized. This will be later dealt with using attach hooks. * freezer->state is now set before trying to push tasks into the target state. -v2: Oleg pointed out that freeze_change_state() was setting freeze->state incorrectly to CGROUP_FROZEN instead of CGROUP_FREEZING. Fixed. -v3: Matt pointed out that setting CGROUP_FROZEN used to always invoke try_to_freeze_cgroup() regardless of the current state. Patch updated such that the actual freeze/thaw operations are always performed on invocation. This shouldn't make any difference unless something is broken. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Paul Menage <paul@paulmenage.org> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Oleg Nesterov <oleg@redhat.com>
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index 93f411a52872..b2b4abc5a739 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -63,11 +63,11 @@ static inline bool try_to_freeze(void)
63extern bool freeze_task(struct task_struct *p, bool sig_only); 63extern bool freeze_task(struct task_struct *p, bool sig_only);
64 64
65#ifdef CONFIG_CGROUP_FREEZER 65#ifdef CONFIG_CGROUP_FREEZER
66extern int cgroup_freezing_or_frozen(struct task_struct *task); 66extern bool cgroup_freezing(struct task_struct *task);
67#else /* !CONFIG_CGROUP_FREEZER */ 67#else /* !CONFIG_CGROUP_FREEZER */
68static inline int cgroup_freezing_or_frozen(struct task_struct *task) 68static inline bool cgroup_freezing(struct task_struct *task)
69{ 69{
70 return 0; 70 return false;
71} 71}
72#endif /* !CONFIG_CGROUP_FREEZER */ 72#endif /* !CONFIG_CGROUP_FREEZER */
73 73