]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge branch 'master' into for-linus
authorRafael J. Wysocki <rjw@sisk.pl>
Sun, 6 Dec 2009 15:06:11 +0000 (16:06 +0100)
committerRafael J. Wysocki <rjw@sisk.pl>
Sun, 6 Dec 2009 15:06:11 +0000 (16:06 +0100)
kernel/power/process.c

index cc2e55373b68cc3f32e83fbf036200c30a14f343..5ade1bdcf366a9e93789097ea99ba8aba9dceccc 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/module.h>
 #include <linux/syscalls.h>
 #include <linux/freezer.h>
+#include <linux/delay.h>
 
 /* 
  * Timeout for stopping processes
@@ -41,7 +42,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 +63,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, but first give the freezing tasks some
+                * time to enter the regrigerator.
+                */
+               msleep(10);
+       }
 
        do_gettimeofday(&end);
        elapsed_csecs64 = timeval_to_ns(&end) - timeval_to_ns(&start);