linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: "Christian König" <ckoenig.leichtzumerken@gmail.com>,
	daniel.vetter@ffwll.ch, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org,
	sumit.semwal@linaro.org
Subject: Re: [PATCH 05/10] dma-buf/resv: add dma_resv_prune_fences
Date: Wed, 21 Aug 2019 15:56:25 +0100	[thread overview]
Message-ID: <156639938517.1374.16561849999409019681@skylake-alporthouse-com> (raw)
In-Reply-To: <156639930822.1374.18129686805314896871@skylake-alporthouse-com>

Quoting Chris Wilson (2019-08-21 15:55:08)
> Quoting Christian König (2019-08-21 13:31:42)
> > Add a new dma_resv_prune_fences() function to improve memory management.
> > 
> > Signed-off-by: Christian König <christian.koenig@amd.com>
> > ---
> >  drivers/dma-buf/dma-resv.c                 | 37 ++++++++++++++++++++++
> >  drivers/gpu/drm/i915/gem/i915_gem_wait.c   |  3 +-
> >  drivers/gpu/drm/i915/i915_gem_batch_pool.c |  2 +-
> >  drivers/gpu/drm/i915/i915_vma.c            |  3 +-
> >  drivers/gpu/drm/ttm/ttm_bo.c               |  2 +-
> >  include/linux/dma-resv.h                   |  1 +
> >  6 files changed, 42 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> > index 42a8f3f11681..24adc32d36d4 100644
> > --- a/drivers/dma-buf/dma-resv.c
> > +++ b/drivers/dma-buf/dma-resv.c
> > @@ -301,6 +301,43 @@ void dma_resv_add_excl_fence(struct dma_resv *obj, struct dma_fence *fence)
> >  }
> >  EXPORT_SYMBOL(dma_resv_add_excl_fence);
> >  
> > +/**
> > + * dma_resv_prune_fences - prune signaled fences from the resv object
> > + * @obj: the reservation object to prune
> > + *
> > + * Prune all signaled fences from the reservation object.
> > + */
> > +void dma_resv_prune_fences(struct dma_resv *obj)
> > +{
> > +       struct dma_resv_list *list;
> > +       struct dma_fence *fence;
> > +       unsigned int i;
> > +
> > +       dma_resv_assert_held(obj);
> > +
> > +       fence = dma_resv_get_excl(obj);
> > +       if (dma_fence_is_signaled(fence)) {
> > +               RCU_INIT_POINTER(obj->fence_excl, NULL);
> > +               dma_fence_put(fence);
> > +       }
> > +
> > +       list = dma_resv_get_list(obj);
> > +       if (!list)
> > +               return;
> > +
> > +       for (i = 0; i < list->shared_count; ++i) {
> > +               fence = rcu_dereference_protected(list->shared[i],
> > +                                                 dma_resv_held(obj));
> > +
> > +               if (!dma_fence_is_signaled(fence))
> > +                       continue;
> > +
> > +               RCU_INIT_POINTER(list->shared[i], dma_fence_get_stub());
> > +               dma_fence_put(fence);
> 
> Not worth reusing the compaction logic from add_shared_fence?

Scratch that, you're going to rewrite the shared fence container.
-Chris

  reply	other threads:[~2019-08-21 14:56 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 12:31 [RFC] replacing dma_resv API Christian König
2019-08-21 12:31 ` [PATCH 01/10] dma-buf: make to_dma_fence_array NULL safe Christian König
2019-08-21 12:31 ` [PATCH 02/10] dma-buf: add dma_fence_array_alloc/free Christian König
2019-08-21 12:31 ` [PATCH 03/10] dma-buf: add dma_fence_array_recycle Christian König
2019-08-21 16:24   ` Chris Wilson
2019-08-22  8:38     ` Christian König
2019-08-21 12:31 ` [PATCH 04/10] dma-buf: add dma_fence_array_for_each Christian König
2019-08-21 12:31 ` [PATCH 05/10] dma-buf/resv: add dma_resv_prune_fences Christian König
2019-08-21 14:55   ` Chris Wilson
2019-08-21 14:56     ` Chris Wilson [this message]
2019-08-21 12:31 ` [PATCH 06/10] dma-buf/resv: stop pruning shared fences when exclusive is added Christian König
2019-08-21 12:31 ` [PATCH 07/10] dma-buf/resv: add new fences container implementation Christian König
2019-08-21 16:04   ` Daniel Vetter
2019-08-22  8:23     ` Christian König
2019-08-22 13:02       ` Daniel Vetter
2019-08-22 13:53         ` Koenig, Christian
2019-08-21 12:31 ` [PATCH 08/10] dma-buf/resv: replace shared fence with new fences container Christian König
2019-08-21 15:24   ` Chris Wilson
2019-08-21 17:35     ` Chris Wilson
2019-08-22  8:37       ` Christian König
2019-08-22  9:16         ` Christian König
2019-08-21 16:21   ` Chris Wilson
2019-08-24 13:22   ` Chris Wilson
2019-08-21 12:31 ` [PATCH 09/10] dma-buf/resv: replace exclusive " Christian König
2019-08-21 12:31 ` [PATCH 10/10] dma-buf/resv: add other operations Christian König
2019-08-22 12:28   ` Ville Syrjälä
2019-08-21 16:13 ` [RFC] replacing dma_resv API Daniel Vetter
2019-08-21 20:05   ` Daniel Vetter
2019-08-22  9:27     ` Christian König
2019-08-21 20:11 ` Chris Wilson
2019-08-21 20:22   ` Daniel Vetter
2019-08-22  9:14     ` Christian König
2019-08-22 10:00       ` Daniel Vetter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=156639938517.1374.16561849999409019681@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).