Re: [PATCH 3/5] workqueue: fixup existing pool->node

Tejun Heo
2015-01-13T15:24:52Z

On Tue, Jan 13, 2015 at 03:08:28PM +0800, Lai Jiangshan wrote:
> On 12/26/2014 04:14 AM, Tejun Heo wrote:
> > On Mon, Dec 15, 2014 at 09:23:49AM +0800, Lai Jiangshan wrote:
> >> The pwqs of the old node's cpumask do be discarded. But the pools of the old
> >> node's cpumask maybe recycle. For example, a new workqueue's affinity is set to
> >> the old node's cpumask before the pool is dead. Any old pool can long live.
> >
> > Hah? Why can't it just be unhashed so that it can't be looked up for
> > new pwqs anymore?
> >
>
> unhashing doesn't reduce the complexity in my code.
>
> for_each_pool(pool, pi) {
> node = calc_pool_node(pool);
> if (pool->node != node)
> - pool->node = node;
> + unhash_pool(pool);
> }

Hah? You shouldn't need any of the dynamic updating code. How does
that not reduce complexity?

> And any old pool can long live due to:
> some works queues themself back and back
> the old pool has extremely long pending works

As long as you don't give out new refs, it's fine. It'll eventually
get drained. Why is this a problem?

> So I prefer to fixup existing pool->node.

Can you please elaborate how this wouldn't remove the dynamic update
code?

Thanks.

--
tejun