Re: [PATCH] workqueue: defer to waiting stop_machine

From: Tejun Heo
Date: Wed Aug 28 2013 - 17:13:22 EST


On Wed, Aug 28, 2013 at 02:07:12PM -0700, Jamie Liu wrote:
...
> @@ -734,7 +735,8 @@ static bool may_start_working(struct worker_pool *pool)
> static bool keep_working(struct worker_pool *pool)
> {
> return !list_empty(&pool->worklist) &&
> - atomic_read(&pool->nr_running) <= 1;
> + atomic_read(&pool->nr_running) <= 1 &&
> + likely(!stop_machine_pending());

Isn't the problem that the kworker wouldn't yield to the higher
priority stopper task while a work item keeps requeueing itself if
preemption is not enabled? If so, isn't the correct solution just
adding cond_resched() in the work item processing loop? The analysis
and solution seem to have gone a bit stray....

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/