dma-buf: make dma_fence structure a bit smaller
PATCH 1/1 dma-buf: make dma_fence structure a bit smaller
The ruc and cb_list are never used at the same time. This smal 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
@@ -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
Quoting Christian König (2019-08-07 14:54:05)
Quoted 2 lines
The ruc and
cb_listare never used at the same time. This smal change is actually making the structure 16% smaller.
(Trivial pair of typos)
Yes. 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 only now makes for a much more spectacular use-after-free. :)
Quoted 1 line
Signed-off-by Christian König <[email protected]>
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Chris Wilson
Quoting Christian König (2019-08-07 14:54:05)
Quoted 2 lines
The ruc and
cb_listare never used at the same time. This smal change is actually making the structure 16% smaller.(Trivial pair of typos)
Yes. We clear the callback list on
kref_putso that by the time we release the fence it is unused. No one should be adding to thecb_listthat they don't themselves hold a reference for, this only now makes for a much more spectacular use-after-free. :)
^^ stuff the above as an inline kerneldoc comment into the patch? And into the commit message too pls. We need better docs for all this scorcery :-)
Thanks, Daniel
Quoted 8 lines
Quoted 2 lines
Signed-off-by Christian König <[email protected]>Reviewed-by Chris Wilson <[email protected]>-Chris
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx