Skip to contentSkip to conversation

dma-buf: make dma_fence structure a bit smaller

PATCH New Christian König 1 participant 1 message Aug 8, 2019 DMA buffer sharing framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-buf: make dma_fence structure a bit smaller

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.

---
 include/linux/dma-fence.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/dma-fence.h +4 -2
index 05d29dbc7e62..3985c72cd0c2 100644
@@ -65,8 +65,10 @@ 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;
+	union {
+		struct rcu_head rcu;
+		struct list_head cb_list;
+	};
 	spinlock_t *lock;
 	u64 context;
 	u64 seqno;
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel