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

From: Tejun Heo
Date: Mon May 12 2014 - 17:26:22 EST


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
--
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/