The kernel now supports madvise ioctl to indicate which BOs can be freed when there is memory pressure. Mark BOs purgeable when they are in the BO cache. The BOs must also be munmapped when they are in the cache or they cannot be purged.
We could optimize avoiding the madvise ioctl on older kernels once the driver version bump lands, but probably not worth it given the other driver features also being added.
d0ec5d38f6c panfrost: Add madvise support to BO cache
src/gallium/drivers/panfrost/pan_bo_cache.c | 21 +++++++++++++++++++++
src/gallium/drivers/panfrost/pan_drm.c | 4 ++--
2 files changed, 23 insertions(+), 2 deletions(-)