[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140507153718.GA26540@htj.dyndns.org>
Date: Wed, 7 May 2014 11:37:18 -0400
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 04/10] workqueue: destroy worker directly in the idle
timeout handler
Hello, Lai.
On Wed, May 07, 2014 at 11:30:35PM +0800, Lai Jiangshan wrote:
> > Hah? How much extra complexity are we talking about? It's a single
> > if, no?
>
> DECLARE_COMPLETION_ONSTACK(completion);
> #1
>
> ...
>
> while ((worker = first_worker(pool))) {
> destroy_worker(worker);
> pool->detach_completion = &completion;
> #2
> }
>
> ...
> unlock;
>
> if (pool->detach_completion)
> wait_for_completion();
> #3
>
> One thing is separated into 3 places and about 5~7lines.
> I hope a single wait_for_completion() or single wait_event().
This is negligible amount of complexity contained in a single
function.
> get_unbound_pool():
> fail:
> if (pool)
> put_unbound_pool(pool);
>
> I think we can change it into:
>
> fail:
> if (pool) {
> if (pool->id >= 0)
> idr_remove(&worker_pool_idr, pool->id);
> call_rcu_sched(&pool->rcu, rcu_free_pool);
> }
This is destruction logic unnecessarily duplicated in two places,
which is shittier to maintain when the destruction path changes.
There's more to complexity than simple number of lines. It sure is a
minute difference here but I find the obsessions with LOC a bit
disturbing. That's just one aspect and involving more lines doesn't
necessarily mean it's more complex.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists