PM / Sleep: Do not check wakeup too often in try_to_freeze_tasks()

Use the observation that it is more efficient to check the wakeup
variable once before the loop reporting tasks that were not
frozen in try_to_freeze_tasks() than to do that in every step of that
loop.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
This commit is contained in:
Rafael J. Wysocki 2012-02-11 00:00:34 +01:00
parent 7c95149b7f
commit 6c83b4818d

View File

@ -98,13 +98,15 @@ static int try_to_freeze_tasks(bool user_only)
elapsed_csecs / 100, elapsed_csecs % 100, elapsed_csecs / 100, elapsed_csecs % 100,
todo - wq_busy, wq_busy); todo - wq_busy, wq_busy);
read_lock(&tasklist_lock); if (!wakeup) {
do_each_thread(g, p) { read_lock(&tasklist_lock);
if (!wakeup && !freezer_should_skip(p) && do_each_thread(g, p) {
p != current && freezing(p) && !frozen(p)) if (p != current && !freezer_should_skip(p)
sched_show_task(p); && freezing(p) && !frozen(p))
} while_each_thread(g, p); sched_show_task(p);
read_unlock(&tasklist_lock); } while_each_thread(g, p);
read_unlock(&tasklist_lock);
}
} else { } else {
printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100, printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100,
elapsed_csecs % 100); elapsed_csecs % 100);