[Mesa-dev] [Mesa-stable] [PATCH 1/2] disk_cache: reduce default cache size to 5% of filesystem

Timothy Arceri tarceri at itsqueeze.com
Sat Apr 29 09:27:23 UTC 2017



On 29/04/17 18:44, Marek Olšák wrote:
> 
> 
> On Apr 29, 2017 4:20 AM, "Michel Dänzer" <michel at daenzer.net 
> <mailto:michel at daenzer.net>> wrote:
> 
>     On 28/04/17 09:11 PM, Marek Olšák wrote:
>      > On Thu, Apr 27, 2017 at 8:47 AM, Michel Dänzer
>     <michel at daenzer.net <mailto:michel at daenzer.net>> wrote:
>      >> On 27/04/17 10:15 AM, Timothy Arceri wrote:
>      >>> Modern disks are extremely large and are only going to get bigger.
>      >>> Usage has shown frequent Mesa upgrades can result in the cache
>      >>> growing very fast i.e. wasting a lot of disk space unnecessarily.
>      >>>
>      >>> 5% seems like a more reasonable default.
>      >>>
>      >>> Cc: "17.1" <mesa-stable at lists.freedesktop.org
>     <mailto:mesa-stable at lists.freedesktop.org>>
>      >>> ---
>      >>>  src/util/disk_cache.c | 4 ++--
>      >>>  1 file changed, 2 insertions(+), 2 deletions(-)
>      >>>
>      >>> diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
>      >>> index d9de8ef..9fd7b96 100644
>      >>> --- a/src/util/disk_cache.c
>      >>> +++ b/src/util/disk_cache.c
>      >>> @@ -324,24 +324,24 @@ disk_cache_create(const char *gpu_name,
>     const char *timestamp)
>      >>>           case '\0':
>      >>>           case 'G':
>      >>>           case 'g':
>      >>>           default:
>      >>>              max_size *= 1024*1024*1024;
>      >>>              break;
>      >>>           }
>      >>>        }
>      >>>     }
>      >>>
>      >>> -   /* Default to 1GB or 10% of filesystem for maximum cache
>     size. */
>      >>> +   /* Default to 1GB or 5% of filesystem for maximum cache
>     size. */
>      >>>     if (max_size == 0) {
>      >>>        statvfs(path, &vfs);
>      >>> -      max_size = MAX2(1024*1024*1024, vfs.f_blocks *
>     vfs.f_bsize / 10);
>      >>> +      max_size = MAX2(1024*1024*1024, vfs.f_blocks *
>     vfs.f_bsize / 20);
>      >>>     }
>      >>
>      >> 5% can still be quite a lot (what if every library on the system
>     tried
>      >> using that much for itself?). How about 1%?
>      >
>      > The argument is flawed. My ccache uses 12% (26.8 GB) of my disk, and
>      > I'm not saying "what if every small app used that much...". There
>     is a
>      > very good reason for that size with my use case.
> 
>     ccache defaults to a maximum cache size of 5G. You had to explicitly
>     allow it to use more; you can do the same with the Mesa shader cache.
> 
> 
>      > It certainly makes sense to use 5% of the filesystem for Mesa.
> 
>     I don't agree for the default, especially as long as the Mesa shader
>     cache only actually makes use of about 10-20% of the disk space
>     allocated for it, due to having a huge number of tiny files. (ccache in
>     contrast actually makes good use of the disk space allocated for it,
>     because its cache entries are normally larger than a single disk block)
> 
> 
> That's a good point. I didn't think of that. Still, if one game evicts 
> all entries, the cache may be almost as good as disabled.

I'm happy for the default limit to be raised from 1GB. However as I 
replied in the other thread using a percentage is not a good idea at 
this stage IMO.

For the majority of use cases 1GB should be more than enough. Deus Ex is 
very shader heavy and when compressed it was only taking up ~30MB, so I 
wouldn't be to worried about entries getting evicted unless there is 
something on the system generating a boat load of unique shaders.


> 
> Marek
> 
> 
> 
>     --
>     Earthling Michel Dänzer               | http://www.amd.com
>     Libre software enthusiast             |             Mesa and X developer
> 
> 


More information about the mesa-dev mailing list