]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cgroup_freezer: prepare for removal of TIF_FREEZE
authorTejun Heo <tj@kernel.org>
Thu, 3 Nov 2011 22:19:27 +0000 (15:19 -0700)
committerTejun Heo <tj@kernel.org>
Thu, 3 Nov 2011 22:19:27 +0000 (15:19 -0700)
commitbf9d5d3d1651f61dd51a4dca513d55e83b40f1b2
tree57576377183ffa7617294b6c7c07142c6780e2d0
parent2981f8990826d8ab411c7d7bba59bfb7540a015c
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>
include/linux/freezer.h
kernel/cgroup_freezer.c
kernel/power/process.c