diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2012-02-11 00:00:34 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rjw@sisk.pl> | 2012-02-13 16:26:05 +0100 |
commit | 6c83b4818dd65eb17e633b6b629a81da7bed90b3 (patch) | |
tree | 97eddcc6d07daf0ea1be84c57e7a687b3d406151 /kernel | |
parent | PM / Sleep: Initialize wakeup source locks in wakeup_source_add() (diff) | |
download | linux-6c83b4818dd65eb17e633b6b629a81da7bed90b3.tar.xz linux-6c83b4818dd65eb17e633b6b629a81da7bed90b3.zip |
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>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/process.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/kernel/power/process.c b/kernel/power/process.c index 7e426459e60a..6aeb5efe00eb 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -98,13 +98,15 @@ static int try_to_freeze_tasks(bool user_only) elapsed_csecs / 100, elapsed_csecs % 100, todo - wq_busy, wq_busy); - read_lock(&tasklist_lock); - do_each_thread(g, p) { - if (!wakeup && !freezer_should_skip(p) && - p != current && freezing(p) && !frozen(p)) - sched_show_task(p); - } while_each_thread(g, p); - read_unlock(&tasklist_lock); + if (!wakeup) { + read_lock(&tasklist_lock); + do_each_thread(g, p) { + if (p != current && !freezer_should_skip(p) + && freezing(p) && !frozen(p)) + sched_show_task(p); + } while_each_thread(g, p); + read_unlock(&tasklist_lock); + } } else { printk("(elapsed %d.%02d seconds) ", elapsed_csecs / 100, elapsed_csecs % 100); |