History

[CPUFREQ] Add queue_delayed_work_on() interface for workqueues.

Add queue_delayed_work_on() interface for workqueues.

Venkatesh Pallipadi committed 20 years ago

Commit 7a6bc1c1 parent ccb2fe22 files · +25 −15Browse files

Showing the changes to kernel/workqueue.c (1 of 2 files). Show all

Unified · Split

kernel/workqueue.c+23−15
@@ -148,6 +148,27 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq, · 147 unmodified lines
148 return ret;148 return ret;
149}149}
150 150
151int queue_delayed_work_on(int cpu, struct workqueue_struct *wq,
152 struct work_struct *work, unsigned long delay)
153{
154 int ret = 0;
155 struct timer_list *timer = &work->timer;
156
157 if (!test_and_set_bit(0, &work->pending)) {
158 BUG_ON(timer_pending(timer));
159 BUG_ON(!list_empty(&work->entry));
160
161 /* This stores wq for the moment, for the timer_fn */
162 work->wq_data = wq;
163 timer->expires = jiffies + delay;
164 timer->data = (unsigned long)work;
165 timer->function = delayed_work_timer_fn;
166 add_timer_on(timer, cpu);
167 ret = 1;
168 }
169 return ret;
170}
171
151static void run_workqueue(struct cpu_workqueue_struct *cwq)172static void run_workqueue(struct cpu_workqueue_struct *cwq)
152{173{
153 unsigned long flags;174 unsigned long flags;
@@ -411,21 +432,7 @@ int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay · 257 unmodified lines
411int schedule_delayed_work_on(int cpu,432int schedule_delayed_work_on(int cpu,
412 struct work_struct *work, unsigned long delay)433 struct work_struct *work, unsigned long delay)
413{434{
414 int ret = 0;435 return queue_delayed_work_on(cpu, keventd_wq, work, delay);
415 struct timer_list *timer = &work->timer;
416
417 if (!test_and_set_bit(0, &work->pending)) {
418 BUG_ON(timer_pending(timer));
419 BUG_ON(!list_empty(&work->entry));
420 /* This stores keventd_wq for the moment, for the timer_fn */
421 work->wq_data = keventd_wq;
422 timer->expires = jiffies + delay;
423 timer->data = (unsigned long)work;
424 timer->function = delayed_work_timer_fn;
425 add_timer_on(timer, cpu);
426 ret = 1;
427 }
428 return ret;
429}436}
430 437
431/**438/**
@@ -622,6 +629,7 @@ void init_workqueues(void) · 190 unmodified lines
622EXPORT_SYMBOL_GPL(__create_workqueue);629EXPORT_SYMBOL_GPL(__create_workqueue);
623EXPORT_SYMBOL_GPL(queue_work);630EXPORT_SYMBOL_GPL(queue_work);
624EXPORT_SYMBOL_GPL(queue_delayed_work);631EXPORT_SYMBOL_GPL(queue_delayed_work);
632EXPORT_SYMBOL_GPL(queue_delayed_work_on);
625EXPORT_SYMBOL_GPL(flush_workqueue);633EXPORT_SYMBOL_GPL(flush_workqueue);
626EXPORT_SYMBOL_GPL(destroy_workqueue);634EXPORT_SYMBOL_GPL(destroy_workqueue);
627 635