All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org
Subject: [PATCH] dma-buf: make dma_fence structure a bit smaller v2
Date: Thu,  8 Aug 2019 15:22:43 +0200	[thread overview]
Message-ID: <20190808132243.23632-1-christian.koenig@amd.com> (raw)

We clear the callback list on kref_put so that by the time we
release the fence it is unused. No one should be adding to the cb_list
that they don't themselves hold a reference for.

This small change is actually making the structure 16% smaller.

v2: add the comment to the code as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 include/linux/dma-fence.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 05d29dbc7e62..bea1d05cf51e 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -65,8 +65,14 @@ struct dma_fence_cb;
 struct dma_fence {
 	struct kref refcount;
 	const struct dma_fence_ops *ops;
-	struct rcu_head rcu;
-	struct list_head cb_list;
+	/* We clear the callback list on kref_put so that by the time we
+	 * release the fence it is unused. No one should be adding to the cb_list
+	 * that they don't themselves hold a reference for.
+	 */
+	union {
+		struct rcu_head rcu;
+		struct list_head cb_list;
+	};
 	spinlock_t *lock;
 	u64 context;
 	u64 seqno;
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2019-08-08 13:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 13:22 Christian König [this message]
2019-08-08 14:41 ` [PATCH] dma-buf: make dma_fence structure a bit smaller v2 Christian König
2019-08-08 19:11   ` Daniel Vetter
2019-08-09 12:15 ` ✗ Fi.CI.CHECKPATCH: warning for dma-buf: make dma_fence structure a bit smaller (rev3) Patchwork
2019-08-09 13:12 ` ✓ Fi.CI.BAT: success " Patchwork
2019-08-10  4:53 ` ✗ Fi.CI.IGT: failure " Patchwork

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=20190808132243.23632-1-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.