Re: [PATCH 04/10 V2] workqueue: destroy worker directly in the idle timeout handler

Tejun Heo
2014-05-12T21:26:15Z

On Mon, May 12, 2014 at 02:56:16PM +0800, Lai Jiangshan wrote:
> @@ -1867,8 +1859,7 @@ static void idle_worker_timeout(unsigned long __pool)
> struct worker_pool *pool = (void *)__pool;
>
> spin_lock_irq(&pool->lock);
> -
> - if (too_many_workers(pool)) {
> + while (too_many_workers(pool)) {

Hey, I like the new line there.

> struct worker *worker;
> unsigned long expires;
>
> @@ -1876,15 +1867,13 @@ static void idle_worker_timeout(unsigned long __pool)
> worker = list_entry(pool->idle_list.prev, struct worker, entry);
> expires = worker->last_active + IDLE_WORKER_TIMEOUT;
>
> - if (time_before(jiffies, expires))
> + if (time_before(jiffies, expires)) {
> mod_timer(&pool->idle_timer, expires);
> - else {
> - /* it's been idle for too long, wake up manager */
> - pool->flags |= POOL_MANAGE_WORKERS;
> - wake_up_worker(pool);
> + break;
> }
> - }
>
> + destroy_worker(worker);
> + }

here too.

Other than the above new line removals, looks great to me.

Thanks.

--
tejun