[Mesa-dev] [PATCH 3/4] i965/drm: Searching for a cached buffer for reuse

James Xiong james.xiong at intel.com
Fri May 11 16:18:02 UTC 2018


On Fri, 11 May 2018 16:57:22 +0100
Chris Wilson <chris at chris-wilson.co.uk> wrote:

> Quoting James Xiong (2018-05-11 16:35:04)
> > On Thu, 10 May 2018 13:56:12 -0700
> > Kenneth Graunke <kenneth at whitecape.org> wrote:
> > 
> > > On Friday, May 4, 2018 5:56:04 PM PDT James Xiong wrote:
> > > > From: "Xiong, James" <james.xiong at intel.com>
> > > > 
> > > > Now that a bucket contains cached buffers with different sizes,
> > > > go through its list and search for a cached buffer with enough
> > > > size.
> > > > 
> > > > Signed-off-by: Xiong, James <james.xiong at intel.com>
<...>
> > > > pos, member);       \ 
> > > 
> > > Hi James,
> > > 
> > > I don't particularly like the idea of introducing linear linked
> > > list walks to find a buffer.  It's a really nice property to have
> > > every buffer in the bucket be suitable and be able to grab one
> > > immediately. It sounds like purging things more often in patch 4
> > > reduces the cost of this new list walk, but...it'd be nice to not
> > > add it in the first place.
> > Yes, the purge, as well as the cleanup routine which kicks in from
> > time
> 
> It should not be time to time, it should be whenever the cache is
> older than a 1s (use a timer thread if you are concerned) as it being
> checked everytime something is put into the cache (and so before the
> lists grow). 
That's exactly how it works, the cleanup gets called before a buffer is
going to be put in the bucket, there is also a check if the an earlier
cleaned up has been performed within 1s BTW.

Sorry for the misleading. 
> If it is overallocating such that you are running out of
> memory and not reusing buffers, the cache is barely functioning. Now
> that's the information you want to present, where/when/why/how the
> cache is not working. What is being put into the cache that is never
> reused? -Chris
I tried to cleanup cached buffers more aggressively, every single time
when a buffer is unreferenced, and measure the memory usage, it didn't
help much. I believe that cached-but-not-get-reused might contribute to
the overhead too but mostly it is from the bucket size roundup.



More information about the mesa-dev mailing list