On 04/23, Jarek Poplawski wrote:This will change the API. Currently it is possible to do: cancel_delayed_work(dwork); schedule_delayed_work(dwork, delay); and we have such a code. With the change you propose this can't work. Look, void cancel_rearming_delayed_work(struct delayed_work *dwork) { struct work_struct *work = &dwork->work; struct cpu_workqueue_struct *cwq = get_wq_data(work); struct workqueue_struct *wq; const cpumask_t *cpu_map; int retry; int cpu; if (!cwq) return; retry: spin_lock_irq(&cwq->lock); list_del_init(&work->entry); __set_bit(WORK_STRUCT_PENDING, work_data_bits(work)); retry = try_to_del_timer_sync(&dwork->timer) < 0; spin_unlock_irq(&cwq->lock); if (unlikely(retry)) goto retry; // the work can't be re-queued and the timer can't // be re-started due to WORK_STRUCT_PENDING wq = cwq->wq; cpu_map = wq_cpu_map(wq); for_each_cpu_mask(cpu, *cpu_map) wait_on_work(per_cpu_ptr(wq->cpu_wq, cpu), work); work_clear_pending(work); } I think this almost works, except: - we should change run_workqueue() to call work_clear_pending() under cwq->lock. I'd like to avoid this. - this is racy wrt cpu-hotplug. We should re-check get_wq_data() when we take the lock. This is easy. - we should factor out the common code with cancel_work_sync(). I may be wrong, still had no time to concentrate on this with a "clear head". May be tomorrow. Why? May be you are right, but still I don't think we should introduce the new flag to implement this imho not-so-useful feature. Oleg. -
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| David Newall | Re: Slow DOWN, please!!! |
| Peter Zijlstra | [PATCH 00/23] per device dirty throttling -v8 |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| David Miller | [GIT]: Networking |
| Natalie Protasevich | [BUG] New Kernel Bugs |
git: | |
