Skip to content

panfrost: Try to limit the size of the BO cache

@alyssa recently reported OOM issues on various apps.

We first thought it could be caused by BO leak but after further investigation it seems to be caused by the unlimited BO caching. This problem was partly solved with MADVISE, but not everyone has a kernel supporting the MADVISE ioctl. Let's try to be more friendly to those who don't and implement some kind of mitigation to this problem.

The solution chosen here is the one used in VC4/V3D: try to evict old/unused entries from the cache, without putting a hard limit on the total cache size. We tried several other things before, like limiting the number of entries per bucket or the total cache size, but those were either too complex or too limiting (in term of perfs and/or memory usage).

This solution is definitely not perfect, and upgrading to a kernel supporting MADVISE is likely to be the only option if you keep experiencing those OOM faults, but it should mitigate the issue for common workloads.

/cc @alyssa @tomeu @daniels @anholt

Merge request reports