Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/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
This commit is contained in:
Linus Torvalds 2010-04-02 19:44:42 -07:00
commit 24b99d1576
3 changed files with 13 additions and 8 deletions

View file

@ -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 */
/*

View file

@ -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);
}
/*

View file

@ -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);
@ -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);