> +/* 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
> > 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?
>
> Yes. Just like msm/freedreno.
Got it. In that case, t
On Mon, Aug 5, 2019 at 9:52 AM Alyssa Rosenzweig
wrote:
>
> > +/* 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
> > + * a
Add support for madvise and a shrinker similar to other drivers. This
allows userspace to mark BOs which can be freed when there is memory
pressure.
Unlike other implementations, we don't depend on struct_mutex. The
driver maintains a list of BOs which can be freed when the shrinker
is called. Acc