[Intel-gfx] [PATCH] dma-buf: Shrink size of struct dma_fence

Chris Wilson chris at chris-wilson.co.uk
Sat Aug 17 11:51:11 UTC 2019


Quoting Koenig, Christian (2019-08-17 12:42:48)
> Am 17.08.19 um 13:39 schrieb Chris Wilson:
> > Rearrange the couple of 32-bit atomics hidden amongst the field of
> > pointers that unnecessarily caused the compiler to insert some padding,
> > shrinks the size of the base struct dma_fence from 80 to 72 bytes on
> > x86-64.
> >
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Christian König <christian.koenig at amd.com>
> 
> Reviewed-by: Christian König <christian.koenig at amd.com>
> 
> BTW: We could also put the timestamp in the union if we want.
> 
> E.g. the cb_list should only be used while the fence is unsignaled, the 
> timestamp while it is signaled and the rcu while it is freed.
> 
> Would save another 8 bytes, bringing us down to 64.

I was looking at packing the error into the flags and shrinking that to
32b to fit inside the magical 64 bytes. You are right about the
timestamp being mutually exclusive with the cb_list. The only caveat
being that no reader would be allowed access to the timestamp unless
they hold a reference (which I think covers all current users).
-Chris


More information about the Intel-gfx mailing list