Re: [PATCH - v3?] workqueue: allow rescuer thread to do more work.

From: Tejun Heo
Date: Thu Dec 04 2014 - 09:57:32 EST


On Thu, Dec 04, 2014 at 09:01:50AM +0800, Lai Jiangshan wrote:
> > + if (need_to_create_worker(pool)) {
> > + spin_lock(&wq_mayday_lock);
> > + list_move_tail(&pwq->mayday_node, &wq->maydays);
>
> how about the pwq is empty now? and ...

It will be taken off list the next round. It's silly to scan the list
again here. The only thing that'd do is adding more code and adding
an extra scan when the pwq actually needs to be requeued.

> > + spin_unlock(&wq_mayday_lock);
> > + }
> > + }
> >
> > /*
> > * Put the reference grabbed by send_mayday(). @pool won't
>
> and the pwq is scheduled free here>

Added get_pwq() before list_move_tail() as Dongsu suggested.

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/