Skip to content

Commit 0e2f733

Browse files
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/
1 parent a84ddb8 commit 0e2f733

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎include/linux/dma-fence.h‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,14 @@ struct dma_fence_cb;
6565
struct dma_fence {
6666
struct kref refcount;
6767
const struct dma_fence_ops *ops;
68-
struct rcu_head rcu;
69-
struct list_head cb_list;
68+
/* We clear the callback list on kref_put so that by the time we
69+
* release the fence it is unused. No one should be adding to the cb_list
70+
* that they don't themselves hold a reference for.
71+
*/
72+
union {
73+
struct rcu_head rcu;
74+
struct list_head cb_list;
75+
};
7076
spinlock_t *lock;
7177
u64 context;
7278
u64 seqno;

0 commit comments

Comments
 (0)