* [PATCH] dma-buf: make dma_fence structure a bit smaller v2
@ 2019-08-08 13:22 Christian König
2019-08-08 14:41 ` Christian König
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2019-08-08 13:22 UTC (permalink / raw)
To: dri-devel, intel-gfx, linaro-mm-sig
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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] dma-buf: make dma_fence structure a bit smaller v2
2019-08-08 13:22 [PATCH] dma-buf: make dma_fence structure a bit smaller v2 Christian König
@ 2019-08-08 14:41 ` Christian König
2019-08-08 19:11 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2019-08-08 14:41 UTC (permalink / raw)
To: dri-devel, intel-gfx, linaro-mm-sig, Daniel Vetter
Daniel any more comments on this one?
If not I'm going to push it.
Christian.
Am 08.08.19 um 15:22 schrieb Christian König:
> 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;
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] dma-buf: make dma_fence structure a bit smaller v2
2019-08-08 14:41 ` Christian König
@ 2019-08-08 19:11 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2019-08-08 19:11 UTC (permalink / raw)
To: Christian König; +Cc: linaro-mm-sig, intel-gfx, dri-devel
On Thu, Aug 08, 2019 at 04:41:39PM +0200, Christian König wrote:
> Daniel any more comments on this one?
It's not kerneldoc, but then all the dma-* docs need some serious love
anyway, so all good with me.
-Daniel
>
> If not I'm going to push it.
>
> Christian.
>
> Am 08.08.19 um 15:22 schrieb Christian König:
> > 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;
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-08 19:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-08 13:22 [PATCH] dma-buf: make dma_fence structure a bit smaller v2 Christian König
2019-08-08 14:41 ` Christian König
2019-08-08 19:11 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox