Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=85f4186af944c1240c84934a9ab578743df2d69b
Commit:     85f4186af944c1240c84934a9ab578743df2d69b
Parent:     b9aac8e0d32499217417ff0b494731811f185b18
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:34:20 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:53 2007 -0700

    worker_thread: fix racy try_to_freeze() usage
    
    worker_thread() can miss freeze_process()->signal_wake_up() if it happens
    between try_to_freeze() and prepare_to_wait().  We should check freezing()
    before entering schedule().
    
    This race was introduced by me in
    
        [PATCH 1/1] workqueue: don't migrate pending works from the dead CPU
    
    Looks like mm/vmscan.c:kswapd() has the same race.
    
    Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/workqueue.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 87693b3..63885ab 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -308,14 +308,14 @@ static int worker_thread(void *__cwq)
        do_sigaction(SIGCHLD, &sa, (struct k_sigaction *)0);
 
        for (;;) {
-               if (cwq->wq->freezeable)
-                       try_to_freeze();
-
                prepare_to_wait(&cwq->more_work, &wait, TASK_INTERRUPTIBLE);
-               if (!cwq->should_stop && list_empty(&cwq->worklist))
+               if (!freezing(current) && !cwq->should_stop
+                   && list_empty(&cwq->worklist))
                        schedule();
                finish_wait(&cwq->more_work, &wait);
 
+               try_to_freeze();
+
                if (cwq_should_stop(cwq))
                        break;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to