[Mesa-dev] [PATCH] disk_cache: make the thread queue resizable and low priority

Timothy Arceri tarceri at itsqueeze.com
Wed Sep 6 23:20:17 UTC 2017


Seems reasonable.

Acked-by: Timothy Arceri <tarceri at itsqueeze.com>

On 07/09/17 08:20, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   src/util/disk_cache.c | 14 ++++++++------
>   1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
> index b789a45..33e4dc8 100644
> --- a/src/util/disk_cache.c
> +++ b/src/util/disk_cache.c
> @@ -351,27 +351,29 @@ disk_cache_create(const char *gpu_name, const char *timestamp,
>         }
>      }
>   
>      /* Default to 1GB for maximum cache size. */
>      if (max_size == 0) {
>         max_size = 1024*1024*1024;
>      }
>   
>      cache->max_size = max_size;
>   
> -   /* A limit of 32 jobs was choosen as observations of Deus Ex start-up times
> -    * showed that we reached at most 11 jobs on an Intel i5-6400 CPU at 2.70GHz
> -    * (a fairly modest desktop CPU). 1 thread was chosen because we don't
> -    * really care about getting things to disk quickly just that it's not
> -    * blocking other tasks.
> +   /* 1 thread was chosen because we don't really care about getting things
> +    * to disk quickly just that it's not blocking other tasks.
> +    *
> +    * The queue will resize automatically when it's full, so adding new jobs
> +    * doesn't stall.
>       */
> -   util_queue_init(&cache->cache_queue, "disk_cache", 32, 1, 0);
> +   util_queue_init(&cache->cache_queue, "disk_cache", 32, 1,
> +                   UTIL_QUEUE_INIT_RESIZE_IF_FULL |
> +                   UTIL_QUEUE_INIT_USE_MINIMUM_PRIORITY);
>   
>      uint8_t cache_version = CACHE_VERSION;
>      size_t cv_size = sizeof(cache_version);
>      cache->driver_keys_blob_size = cv_size;
>   
>      /* Create driver id keys */
>      size_t ts_size = strlen(timestamp) + 1;
>      size_t gpu_name_size = strlen(gpu_name) + 1;
>      cache->driver_keys_blob_size += ts_size;
>      cache->driver_keys_blob_size += gpu_name_size;
> 


More information about the mesa-dev mailing list