[Intel-gfx] [RFC PATCH 05/42] drm/i915/region: support basic eviction

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 26 16:49:19 UTC 2019


Quoting Matthew Auld (2019-02-26 14:58:31)
> On Thu, 14 Feb 2019 at 15:25, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> >
> > Quoting Matthew Auld (2019-02-14 14:57:03)
> > > +       list_for_each_entry(obj, &mem->purgeable, region_link) {
> > > +               if (!i915_gem_object_has_pages(obj))
> > > +                       continue;
> > > +
> > > +               if (READ_ONCE(obj->pin_global))
> > > +                       continue;
> > > +
> > > +               if (atomic_read(&obj->mm.pages_pin_count) > obj->bind_count)
> > > +                       continue;
> > > +
> > > +               list_add(&obj->tmp_link, &purgeable);
> >
> > Oh crikey.
> 
> What's the crikey for? We do the purging in two passes? Yeah, I guess
> that's kinda garbage. There is definitely some leftover baggage from
> when we did "interesting" things in here, which needs to be fixed up.

"tmp_link" has a very bad taste (prior experience turned sour), and this
turns out to be lacking in locking. Pesky little global thing.
Alternatives tend to be to dynamically allocate list entries. My favourite
half-baked idea is to use an XArray for a chunked list (so we get storage
allocated for a bunch of entries at once).
-Chris


More information about the Intel-gfx mailing list