On 06/11, Max Krasnyansky wrote:>> Oleg Nesterov wrote:> > > > Yes, it is easy to implement flush_work(struct work_struct *work) which> > only waits for that work, so it can't hang unless it was enqueued on the> > isolated cpu.> > > > But in most cases it is enough to just do> > > > if (cancel_work_sync(work))> > work->func(work);> Cool. That would work.> btw Somehow I thought that you already implemented flush_work(). I do not see> it 2.6.25 but I could've sworn that I saw a patch flying by. Must have been> something else. Do you mind adding that ?

Well... I don't think Andrew will take this patch right now... OK, I'll sendthe preparation patch with comments. Do you see an immediate user for thishelper?

> > Or we can add flush_workqueue_cpus(struct workqueue_struct *wq, cpumask_t *cpu_map).> That'd be special casing. I mean something will have to know what cpus cannot> be flushed.

OK, we can make it flush_workqueue_except_isolated_cpus(struct workqueue_struct *wq).

> I liked your proposal above much better.

it was Peter who suggested this ;)

> > But I don't think we should change the behaviour of flush_workqueue().> > > >> This will require a bit of surgery across the entire tree. There is a lot of> >> code that calls flush_scheduled_work()> > > > Almost all of them should be changed to use cancel_work_sync().> > That'd be a lot of changes.>> git grep flush_scheduled_work | wc> 154 376 8674> > Hmm, I guess maybe not that bad. I might actually do that :-).