[sheepdog] [PATCH] work queue: introduce dynamic roof to max nr threads

MORITA Kazutaka morita.kazutaka at gmail.com
Mon Mar 4 16:58:15 CET 2013


At Mon, 04 Mar 2013 23:51:01 +0800,
Liu Yuan wrote:
> 
> On 03/04/2013 11:40 PM, MORITA Kazutaka wrote:
> > Should be wi->nr_threads < wq_get_roof(wi->tc)?  Otherwise,
> > wi->nr_threads can exceed the return value of wq_get_roof.
> 
> For dynamic work threads, I deliberately allow 2x of roof. Maybe we can
> check internally at wq_need_grow():
> 
>    ret = wi->nr_threads < wi->nr_pending + wi->nr_running &&
>                         wi->nr_threads * 2 <= wq_get_roof(wi->tc);
> 
> and return real roof that is never to be exceeded.

Looks better to me.

Thanks,

Kazutaka



More information about the sheepdog mailing list