aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2019-09-03 14:13:05 +1000
committerTimothy Arceri <[email protected]>2019-09-19 15:03:27 +1000
commita2ee29c3daad8fcfe98204f9d8927b0b1a637713 (patch)
treedef62d717831ced0a2506f2cf45da5a38f59ea2c /src
parent8e614c7a29a8926b20f5c18ef447ff82cafb7f1c (diff)
util/disk_cache: bump thread count assigned to disk cache queue
Since we set the UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY flag this should have little impact on low core systems. However just about all modern CPUs currently available that run Mesa have *at least* 4 cores. For these CPUs allowing more threads can result in the queue being processed faster and avoid excessive memory use due to a backlog of cache entrys building up in the queue. This change helps avoid a huge build up of cache entrys in the queue due to using both the UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY and UTIL_QUEUE_INIT_RESIZE_IF_FULL flags. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/util/disk_cache.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index b14a723c5cd..ed2e437a159 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -369,13 +369,17 @@ disk_cache_create(const char *gpu_name, const char *driver_id,
cache->max_size = max_size;
- /* 1 thread was chosen because we don't really care about getting things
- * to disk quickly just that it's not blocking other tasks.
+ /* 4 threads were chosen below because just about all modern CPUs currently
+ * available that run Mesa have *at least* 4 cores. For these CPUs allowing
+ * more threads can result in the queue being processed faster, thus
+ * avoiding excessive memory use due to a backlog of cache entrys building
+ * up in the queue. Since we set the UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY
+ * flag this should have little negative impact on low core systems.
*
* The queue will resize automatically when it's full, so adding new jobs
* doesn't stall.
*/
- util_queue_init(&cache->cache_queue, "disk$", 32, 1,
+ util_queue_init(&cache->cache_queue, "disk$", 32, 4,
UTIL_QUEUE_INIT_RESIZE_IF_FULL |
UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY |
UTIL_QUEUE_INIT_SET_FULL_THREAD_AFFINITY);