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

Liu Yuan namei.unix at gmail.com
Mon Mar 4 16:51:01 CET 2013


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.

Thanks,
Yuan



More information about the sheepdog mailing list