aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index d107e1c3b071..0eb9b33f1d91 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -180,28 +180,11 @@ void delayed_work_timer_fn(unsigned long __data)
180int fastcall queue_delayed_work(struct workqueue_struct *wq, 180int fastcall queue_delayed_work(struct workqueue_struct *wq,
181 struct delayed_work *dwork, unsigned long delay) 181 struct delayed_work *dwork, unsigned long delay)
182{ 182{
183 int ret = 0; 183 timer_stats_timer_set_start_info(&dwork->timer);
184 struct timer_list *timer = &dwork->timer;
185 struct work_struct *work = &dwork->work;
186
187 timer_stats_timer_set_start_info(timer);
188 if (delay == 0) 184 if (delay == 0)
189 return queue_work(wq, work); 185 return queue_work(wq, &dwork->work);
190
191 if (!test_and_set_bit(WORK_STRUCT_PENDING, work_data_bits(work))) {
192 BUG_ON(timer_pending(timer));
193 BUG_ON(!list_empty(&work->entry));
194 186
195 /* This stores cwq for the moment, for the timer_fn */ 187 return queue_delayed_work_on(-1, wq, dwork, delay);
196 set_wq_data(work,
197 per_cpu_ptr(wq->cpu_wq, raw_smp_processor_id()));
198 timer->expires = jiffies + delay;
199 timer->data = (unsigned long)dwork;
200 timer->function = delayed_work_timer_fn;
201 add_timer(timer);
202 ret = 1;
203 }
204 return ret;
205} 188}
206EXPORT_SYMBOL_GPL(queue_delayed_work); 189EXPORT_SYMBOL_GPL(queue_delayed_work);
207 190
@@ -227,11 +210,16 @@ int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
227 210
228 /* This stores cwq for the moment, for the timer_fn */ 211 /* This stores cwq for the moment, for the timer_fn */
229 set_wq_data(work, 212 set_wq_data(work,
230 per_cpu_ptr(wq->cpu_wq, raw_smp_processor_id())); 213 per_cpu_ptr(wq->cpu_wq, wq->singlethread ?
214 singlethread_cpu : raw_smp_processor_id()));
231 timer->expires = jiffies + delay; 215 timer->expires = jiffies + delay;
232 timer->data = (unsigned long)dwork; 216 timer->data = (unsigned long)dwork;
233 timer->function = delayed_work_timer_fn; 217 timer->function = delayed_work_timer_fn;
234 add_timer_on(timer, cpu); 218
219 if (unlikely(cpu >= 0))
220 add_timer_on(timer, cpu);
221 else
222 add_timer(timer);
235 ret = 1; 223 ret = 1;
236 } 224 }
237 return ret; 225 return ret;