lkml.org 
[lkml]   [2014]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/10 V2] workqueue: destroy worker directly in the idle timeout handler
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


\
 
 \ /
  Last update: 2014-05-12 23:41    [W:0.398 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site