Skip to content

Commit

Permalink
Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/rafael/suspend-2.6

* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
  Freezer: Fix buggy resume test for tasks frozen with cgroup freezer
  Freezer: Only show the state of tasks refusing to freeze
  • Loading branch information
Linus Torvalds committed Apr 3, 2010
2 parents 6da8d86 + 5a7aadf commit 24b99d1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
7 changes: 5 additions & 2 deletions include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ extern bool freeze_task(struct task_struct *p, bool sig_only);
extern void cancel_freezing(struct task_struct *p);

#ifdef CONFIG_CGROUP_FREEZER
extern int cgroup_frozen(struct task_struct *task);
extern int cgroup_freezing_or_frozen(struct task_struct *task);
#else /* !CONFIG_CGROUP_FREEZER */
static inline int cgroup_frozen(struct task_struct *task) { return 0; }
static inline int cgroup_freezing_or_frozen(struct task_struct *task)
{
return 0;
}
#endif /* !CONFIG_CGROUP_FREEZER */

/*
Expand Down
9 changes: 6 additions & 3 deletions kernel/cgroup_freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ static inline struct freezer *task_freezer(struct task_struct *task)
struct freezer, css);
}

int cgroup_frozen(struct task_struct *task)
int cgroup_freezing_or_frozen(struct task_struct *task)
{
struct freezer *freezer;
enum freezer_state state;

task_lock(task);
freezer = task_freezer(task);
state = freezer->state;
if (!freezer->css.cgroup->parent)
state = CGROUP_THAWED; /* root cgroup can't be frozen */
else
state = freezer->state;
task_unlock(task);

return state == CGROUP_FROZEN;
return (state == CGROUP_FREEZING) || (state == CGROUP_FROZEN);
}

/*
Expand Down
5 changes: 2 additions & 3 deletions kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ static int try_to_freeze_tasks(bool sig_only)
printk(KERN_ERR "Freezing of tasks failed after %d.%02d seconds "
"(%d tasks refusing to freeze):\n",
elapsed_csecs / 100, elapsed_csecs % 100, todo);
show_state();
read_lock(&tasklist_lock);
do_each_thread(g, p) {
task_lock(p);
if (freezing(p) && !freezer_should_skip(p))
printk(KERN_ERR " %s\n", p->comm);
sched_show_task(p);
cancel_freezing(p);
task_unlock(p);
} while_each_thread(g, p);
Expand Down Expand Up @@ -145,7 +144,7 @@ static void thaw_tasks(bool nosig_only)
if (nosig_only && should_send_signal(p))
continue;

if (cgroup_frozen(p))
if (cgroup_freezing_or_frozen(p))
continue;

thaw_process(p);
Expand Down

0 comments on commit 24b99d1

Please sign in to comment.