lkml.org 
[lkml]   [2009]   [Oct]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 01/19] freezer: don't get over-anxious while waiting
Date
Freezing isn't exactly the most latency sensitive operation and
there's no reason to burn cpu cycles and power waiting for it to
complete. msleep(10) instead of yield(). This should improve
reliability of emergency hibernation.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
kernel/power/process.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/kernel/power/process.c b/kernel/power/process.c
index cc2e553..9d26a0a 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -41,7 +41,7 @@ static int try_to_freeze_tasks(bool sig_only)
do_gettimeofday(&start);

end_time = jiffies + TIMEOUT;
- do {
+ while (true) {
todo = 0;
read_lock(&tasklist_lock);
do_each_thread(g, p) {
@@ -62,10 +62,15 @@ static int try_to_freeze_tasks(bool sig_only)
todo++;
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
- yield(); /* Yield is okay here */
- if (time_after(jiffies, end_time))
+ if (!todo || time_after(jiffies, end_time))
break;
- } while (todo);
+
+ /*
+ * We need to retry. There's no reason to be
+ * over-anxious about it and waste power.
+ */
+ msleep(10);
+ }

do_gettimeofday(&end);
elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);
--
1.6.4.2


\
 
 \ /
  Last update: 2009-10-01 10:15    [W:0.300 / U:3.144 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site