util/disk_cache: Switch to multipart mesa-db cache

Replace single file mesa-db cache with multipart mesa-db cache.
Each part of the multipart cache essentially is a single file
mesa-db cache, aka database shard. Multipart cache brings much
more optimized cache eviction times in comparison to a single file
cache.

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20256>
This commit is contained in:
Dmitry Osipenko
2022-10-24 20:46:21 +03:00
committed by Marge Bot
parent fd9f7b748e
commit 4fe2247be5
3 changed files with 11 additions and 9 deletions
+3 -3
View File
@@ -190,7 +190,7 @@ disk_cache_type_create(const char *gpu_name,
cache->max_size = max_size;
if (cache->type == DISK_CACHE_DATABASE)
mesa_cache_db_set_size_limit(&cache->cache_db, cache->max_size);
mesa_cache_db_multipart_set_size_limit(&cache->cache_db, cache->max_size);
/* 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
@@ -318,7 +318,7 @@ disk_cache_destroy(struct disk_cache *cache)
foz_destroy(&cache->foz_db);
if (cache->type == DISK_CACHE_DATABASE)
mesa_cache_db_close(&cache->cache_db);
mesa_cache_db_multipart_close(&cache->cache_db);
disk_cache_destroy_mmap(cache);
}
@@ -336,7 +336,7 @@ void
disk_cache_remove(struct disk_cache *cache, const cache_key key)
{
if (cache->type == DISK_CACHE_DATABASE) {
mesa_cache_db_entry_remove(&cache->cache_db, key);
mesa_cache_db_multipart_entry_remove(&cache->cache_db, key);
return;
}