* Oleg Nesterov <oleg@xxxxxxxxxx> wrote: > On 01/26, Ingo Molnar wrote: > > > > Andrew's suggestion does make sense though: for any not-in-progress > > worklet we can dequeue that worklet and execute it in the flushing > > context. [ And if that worklet cannot be dequeued because it's being > > processed then that's fine and we can wait on that single worklet, without > > waiting on any other 'unrelated' worklets. ] > > Yes sure. This is easy, and I am not sure we need the special handler. > If the caller wants this behaviour, it can do: > > if (cancel_work_sync(work)) > work->func(work); > > But flush_work() was specially introduced for the case when we can't > do the above, it would be better to have this implicit in some wait_for_work() facility (which flush_work() really is) - because it is not intuitive to code a serialization as a 'cancel + execute open-coded' sequence. > > That does not help work_on_cpu() though: that facility really uses the > > fact that workqueues are implemented via per CPU threads - hence we > > cannot remove the worklet from the queue and execute it in the > > flushing context. > > Yes. it's arguably a (mild, albeit elegant) abuse of workqueue internals though. Ingo -- To unsubscribe from this list: send the line "unsubscribe cpufreq" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html