Re: [PATCH 2/2] drm/panfrost: Add madvise and shrinker support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 5, 2019 at 9:52 AM Alyssa Rosenzweig
<alyssa.rosenzweig@xxxxxxxxxxxxx> 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
> > + * 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?

Yes. Just like msm/freedreno.

> Or just remmap? Or something else?
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux