Mesa (master): util/disk_cache: remove percentage based max cache limit

Timothy Arceri tarceri at kemper.freedesktop.org
Fri Apr 28 04:36:04 UTC 2017


Module: Mesa
Branch: master
Commit: 22fa3d90a92c1628215d0f5fccbe1116d4f5147f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=22fa3d90a92c1628215d0f5fccbe1116d4f5147f

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Fri Apr 28 13:05:52 2017 +1000

util/disk_cache: remove percentage based max cache limit

The more I think about it the more this seems like a bad idea.
When we were deleting old cache dirs this wasn't so bad as it
was unlikely we would ever hit the actual limit before things
were cleaned up. Now that we only start cleaning up old cache
items once the limit is reached the a percentage based max
cache limit is more risky.

For the inital release of shader cache I think its better to
stick to a more conservative cache limit, at least until we
have some way of cleaning up the cache more aggressively.

Cc: "17.1" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

---

 src/util/disk_cache.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index cc9faff013..cf5d518f09 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -31,7 +31,6 @@
 #include <sys/file.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/statvfs.h>
 #include <sys/mman.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -47,7 +46,6 @@
 #include "util/mesa-sha1.h"
 #include "util/ralloc.h"
 #include "main/errors.h"
-#include "util/macros.h"
 
 #include "disk_cache.h"
 
@@ -171,7 +169,6 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
    uint64_t max_size;
    int fd = -1;
    struct stat sb;
-   struct statvfs vfs = { 0 };
    size_t size;
 
    /* If running as a users other than the real user disable cache */
@@ -331,10 +328,9 @@ disk_cache_create(const char *gpu_name, const char *timestamp)
       }
    }
 
-   /* Default to 1GB or 5% of filesystem for maximum cache size. */
+   /* Default to 1GB for maximum cache size. */
    if (max_size == 0) {
-      statvfs(path, &vfs);
-      max_size = MAX2(1024*1024*1024, vfs.f_blocks * vfs.f_bsize / 20);
+      max_size = 1024*1024*1024;
    }
 
    cache->max_size = max_size;




More information about the mesa-commit mailing list