]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/workqueue.c
workqueue: cond_resched() after processing each work item
[karo-tx-linux.git] / kernel / workqueue.c
index 7f5d4be220345b0899d38ced692f2458b9278ce7..e93f7b9067d80a9a407df8eaed869e3b3c54299a 100644 (file)
@@ -2201,6 +2201,15 @@ __acquires(&pool->lock)
                dump_stack();
        }
 
+       /*
+        * The following prevents a kworker from hogging CPU on !PREEMPT
+        * kernels, where a requeueing work item waiting for something to
+        * happen could deadlock with stop_machine as such work item could
+        * indefinitely requeue itself while all other CPUs are trapped in
+        * stop_machine.
+        */
+       cond_resched();
+
        spin_lock_irq(&pool->lock);
 
        /* clear cpu intensive status */