diff options
author | Tejun Heo <tj@kernel.org> | 2012-08-03 10:30:46 -0700 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2012-08-03 10:30:46 -0700 |
commit | 715f1300802e6eaefa85f6cfc70ae99af3d5d497 (patch) | |
tree | 1348231ae08bcb722e860aebe2e46a0565a86fd7 /kernel/workqueue.c | |
parent | 57469821fd5c61f25f783827d7334063cff67d65 (diff) | |
download | kernel_goldelico_gta04-715f1300802e6eaefa85f6cfc70ae99af3d5d497.zip kernel_goldelico_gta04-715f1300802e6eaefa85f6cfc70ae99af3d5d497.tar.gz kernel_goldelico_gta04-715f1300802e6eaefa85f6cfc70ae99af3d5d497.tar.bz2 |
workqueue: fix zero @delay handling of queue_delayed_work_on()
If @delay is zero and the dealyed_work is idle, queue_delayed_work()
queues it for immediate execution; however, queue_delayed_work_on()
lacks this logic and always goes through timer regardless of @delay.
This patch moves 0 @delay handling logic from queue_delayed_work() to
queue_delayed_work_on() so that both functions behave the same.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index ce60bb5..6cbdc22 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -1125,7 +1125,9 @@ EXPORT_SYMBOL_GPL(delayed_work_timer_fn); * @dwork: work to queue * @delay: number of jiffies to wait before queueing * - * Returns %false if @work was already on a queue, %true otherwise. + * Returns %false if @work was already on a queue, %true otherwise. If + * @delay is zero and @dwork is idle, it will be scheduled for immediate + * execution. */ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay) @@ -1135,6 +1137,9 @@ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, bool ret = false; unsigned long flags; + if (!delay) + return queue_work_on(cpu, wq, &dwork->work); + /* read the comment in __queue_work() */ local_irq_save(flags); @@ -1185,14 +1190,11 @@ EXPORT_SYMBOL_GPL(queue_delayed_work_on); * @dwork: delayable work to queue * @delay: number of jiffies to wait before queueing * - * Returns %false if @work was already on a queue, %true otherwise. + * Equivalent to queue_delayed_work_on() but tries to use the local CPU. */ bool queue_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, unsigned long delay) { - if (delay == 0) - return queue_work(wq, &dwork->work); - return queue_delayed_work_on(WORK_CPU_UNBOUND, wq, dwork, delay); } EXPORT_SYMBOL_GPL(queue_delayed_work); |