Commit d5de4ddb authored by Tomasz Buchert's avatar Tomasz Buchert Committed by Linus Torvalds

cgroup_freezer: unnecessary test in cgroup_freezing_or_frozen()

The root freezer_state is always CGROUP_THAWED so we can remove the
special case from the code.  The test itself can be handy and is extracted
to static function.
Signed-off-by: default avatarTomasz Buchert <tomasz.buchert@inria.fr>
Cc: Matt Helsley <matthltc@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent abffc020
...@@ -48,20 +48,19 @@ static inline struct freezer *task_freezer(struct task_struct *task) ...@@ -48,20 +48,19 @@ static inline struct freezer *task_freezer(struct task_struct *task)
struct freezer, css); struct freezer, css);
} }
int cgroup_freezing_or_frozen(struct task_struct *task) static inline int __cgroup_freezing_or_frozen(struct task_struct *task)
{ {
struct freezer *freezer; enum freezer_state state = task_freezer(task)->state;
enum freezer_state state; return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN);
}
int cgroup_freezing_or_frozen(struct task_struct *task)
{
int result;
task_lock(task); task_lock(task);
freezer = task_freezer(task); result = __cgroup_freezing_or_frozen(task);
if (!freezer->css.cgroup->parent)
state = CGROUP_THAWED; /* root cgroup can't be frozen */
else
state = freezer->state;
task_unlock(task); task_unlock(task);
return result;
return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment