util/u_queue: rework UTIL_QUEUE_INIT_SCALE_THREADS to scale faster
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Mon, 2 May 2022 11:25:03 +0000 (13:25 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 13 May 2022 14:40:56 +0000 (14:40 +0000)
commit7357ce19a257fadb47a3b39b9b43a17658f7fe6f
treeced457b23e53767dafbb3c51a0e2bdda71a32835
parent76356ed2082f57db3d5d73cfee383a51980cba9a
util/u_queue: rework UTIL_QUEUE_INIT_SCALE_THREADS to scale faster

The original code waiting for the queue to be full before adding more
threads. This makes the thread count grow slowly, especially if the
queue also uses UTIL_QUEUE_INIT_RESIZE_IF_FULL.

This commit changes this behavior: now a new thread is spawned if we're
adding a job to a non-empty queue because this means that the existing
threads fail to process jobs faster than they're queued.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16273>
src/util/u_queue.c