[PATCH 2/2] drm/panfrost: Add madvise and shrinker support
Alyssa Rosenzweig
alyssa.rosenzweig at collabora.com
Mon Aug 5 15:52:09 UTC 2019
> +/* madvise provides a way to tell the kernel in case a buffers contents
> + * can be discarded under memory pressure, which is useful for userspace
> + * bo cache where we want to optimistically hold on to buffer allocate
> + * and potential mmap, but allow the pages to be discarded under memory
> + * pressure.
> + *
> + * Typical usage would involve madvise(DONTNEED) when buffer enters BO
> + * cache, and madvise(WILLNEED) if trying to recycle buffer from BO cache.
> + * In the WILLNEED case, 'retained' indicates to userspace whether the
> + * backing pages still exist.
> + */
> +#define PANFROST_MADV_WILLNEED 0 /* backing pages are needed, status returned in 'retained' */
> +#define PANFROST_MADV_DONTNEED 1 /* backing pages not needed */
> +
> +struct drm_panfrost_madvise {
> + __u32 handle; /* in, GEM handle */
> + __u32 madv; /* in, PANFROST_MADV_x */
> + __u32 retained; /* out, whether backing store still exists */
> +};
Just to clarify about the `retained` flag: if userspace does a
madvise(WILLNEED) and we find out that retained=0, what's supposed to
happen?
Should userspace evict the BO from its local cache and allocate one
fresh? Or just remmap? Or something else?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190805/11110234/attachment-0001.sig>
More information about the dri-devel
mailing list