[Intel-gfx] [PATCH 03/28] drm/i915: Combine unbound/bound list tracking for objects

Chris Wilson chris at chris-wilson.co.uk
Mon Jun 10 11:06:42 UTC 2019


Quoting Matthew Auld (2019-06-10 12:01:17)
> On Mon, 10 Jun 2019 at 08:21, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> > @@ -329,7 +329,8 @@ void i915_gem_free_object(struct drm_gem_object *gem_obj)
> >
> >                 obj->mm.madv = I915_MADV_DONTNEED;
> >
> > -               if (i915_gem_object_has_pages(obj)) {
> > +               if (i915_gem_object_has_pages(obj) &&
> > +                   i915_gem_object_is_shrinkable(obj)) {
> 
> Should be covered by discard_backing_storage() I guess. Meh.

Hmm, that is true. I was just doing the grep for the list, so from that
pov better safe than sorry. Might be worth just dropping that in lieu of
a comment.

> >  static int i915_gem_object_info(struct seq_file *m, void *data)
> >  {
> > -       struct drm_i915_private *dev_priv = node_to_i915(m->private);
> > -       struct drm_device *dev = &dev_priv->drm;
> > -       struct i915_ggtt *ggtt = &dev_priv->ggtt;
> > -       u32 count, mapped_count, purgeable_count, dpy_count, huge_count;
> > -       u64 size, mapped_size, purgeable_size, dpy_size, huge_size;
> > -       struct drm_i915_gem_object *obj;
> > -       unsigned int page_sizes = 0;
> > -       char buf[80];
> > +       struct drm_i915_private *i915 = node_to_i915(m->private);
> >         int ret;
> >
> >         seq_printf(m, "%u shrinkable objects, %llu bytes\n",
> > -                  dev_priv->mm.shrink_count,
> > -                  dev_priv->mm.shrink_memory);
> > -
> > -       size = count = 0;
> > -       mapped_size = mapped_count = 0;
> > -       purgeable_size = purgeable_count = 0;
> > -       huge_size = huge_count = 0;
> > -
> > -       spin_lock(&dev_priv->mm.obj_lock);
> > -       list_for_each_entry(obj, &dev_priv->mm.unbound_list, mm.link) {
> > -               size += obj->base.size;
> > -               ++count;
> > -
> > -               if (obj->mm.madv == I915_MADV_DONTNEED) {
> > -                       purgeable_size += obj->base.size;
> > -                       ++purgeable_count;
> > -               }
> > -
> > -               if (obj->mm.mapping) {
> > -                       mapped_count++;
> > -                       mapped_size += obj->base.size;
> > -               }
> > -
> > -               if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
> > -                       huge_count++;
> > -                       huge_size += obj->base.size;
> > -                       page_sizes |= obj->mm.page_sizes.sg;
> > -               }
> > -       }
> > -       seq_printf(m, "%u unbound objects, %llu bytes\n", count, size);
> > -
> > -       size = count = dpy_size = dpy_count = 0;
> > -       list_for_each_entry(obj, &dev_priv->mm.bound_list, mm.link) {
> > -               size += obj->base.size;
> > -               ++count;
> > -
> > -               if (obj->pin_global) {
> > -                       dpy_size += obj->base.size;
> > -                       ++dpy_count;
> > -               }
> > -
> > -               if (obj->mm.madv == I915_MADV_DONTNEED) {
> > -                       purgeable_size += obj->base.size;
> > -                       ++purgeable_count;
> > -               }
> > -
> > -               if (obj->mm.mapping) {
> > -                       mapped_count++;
> > -                       mapped_size += obj->base.size;
> > -               }
> > -
> > -               if (obj->mm.page_sizes.sg > I915_GTT_PAGE_SIZE) {
> > -                       huge_count++;
> > -                       huge_size += obj->base.size;
> > -                       page_sizes |= obj->mm.page_sizes.sg;
> > -               }
> > -       }
> > -       spin_unlock(&dev_priv->mm.obj_lock);
> > -
> > -       seq_printf(m, "%u bound objects, %llu bytes\n",
> > -                  count, size);
> > -       seq_printf(m, "%u purgeable objects, %llu bytes\n",
> > -                  purgeable_count, purgeable_size);
> > -       seq_printf(m, "%u mapped objects, %llu bytes\n",
> > -                  mapped_count, mapped_size);
> > -       seq_printf(m, "%u huge-paged objects (%s) %llu bytes\n",
> > -                  huge_count,
> > -                  stringify_page_sizes(page_sizes, buf, sizeof(buf)),
> > -                  huge_size);
> > -       seq_printf(m, "%u display objects (globally pinned), %llu bytes\n",
> > -                  dpy_count, dpy_size);
> 
> Worth keeping some of this tracking through
> mm.shrink_list/mm.purge_list? Or perhaps not much value?

I've long since stopped finding that information useful, so when a
conflict arose I just deleted it. I am fairly optimistic the next time
we have a bug, we will find a way to dump the relevant info (the only
problem being is that interested parties may push for that information
to be stable ABI :-).
-Chris


More information about the Intel-gfx mailing list