Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=edab2516a6c1752e8e5e3d55727cabf12346e5df
Commit:     edab2516a6c1752e8e5e3d55727cabf12346e5df
Parent:     b89deed32ccc96098bd6bc953c64bba6b847774f
Author:     Andrew Morton <[EMAIL PROTECTED]>
AuthorDate: Wed May 9 02:33:53 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed May 9 12:30:51 2007 -0700

    flush_workqueue(): use preempt_disable to hold off cpu hotplug
    
    Cc: Oleg Nesterov <[EMAIL PROTECTED]>
    Cc: Srivatsa Vaddagiri <[EMAIL PROTECTED]>
    Cc: Gautham Shenoy <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 kernel/workqueue.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 918d552..5176d51 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -419,18 +419,22 @@ static void flush_cpu_workqueue(struct 
cpu_workqueue_struct *cwq)
                 * Probably keventd trying to flush its own queue. So simply run
                 * it by hand rather than deadlocking.
                 */
-               mutex_unlock(&workqueue_mutex);
+               preempt_enable();
+               /*
+                * We can still touch *cwq here because we are keventd, and
+                * hot-unplug will be waiting us to exit.
+                */
                run_workqueue(cwq);
-               mutex_lock(&workqueue_mutex);
+               preempt_disable();
        } else {
                struct wq_barrier barr;
 
                init_wq_barrier(&barr);
                __queue_work(cwq, &barr.work);
 
-               mutex_unlock(&workqueue_mutex);
+               preempt_enable();       /* Can no longer touch *cwq */
                wait_for_completion(&barr.done);
-               mutex_lock(&workqueue_mutex);
+               preempt_disable();
        }
 }
 
@@ -449,7 +453,7 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct 
*cwq)
  */
 void fastcall flush_workqueue(struct workqueue_struct *wq)
 {
-       mutex_lock(&workqueue_mutex);
+       preempt_disable();              /* CPU hotplug */
        if (is_single_threaded(wq)) {
                /* Always use first cpu's area. */
                flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, singlethread_cpu));
@@ -459,7 +463,7 @@ void fastcall flush_workqueue(struct workqueue_struct *wq)
                for_each_online_cpu(cpu)
                        flush_cpu_workqueue(per_cpu_ptr(wq->cpu_wq, cpu));
        }
-       mutex_unlock(&workqueue_mutex);
+       preempt_enable();
 }
 EXPORT_SYMBOL_GPL(flush_workqueue);
 
-
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