summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2019-08-07 12:31:48 +0200
committerChristian König <christian.koenig@amd.com>2019-08-10 12:30:07 +0200
commit0e2f733addbf7702065cc18d38b67a1284d0c2be (patch)
treeeead8f17ec88ec30401cb0c7f339b559a28bf924 /include
parenta84ddb83806ed43a67f6fe6a03b0b4695cc314c3 (diff)
dma-buf: make dma_fence structure a bit smaller v2
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> Link: https://patchwork.freedesktop.org/patch/322916/
Diffstat (limited to 'include')
-rw-r--r--include/linux/dma-fence.h10
1 files 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;