Reorder struct virtio_vsock fields to place the DMA buffer (event_list)
last. This eliminates the need for __dma_from_device_aligned_end padding
after the DMA buffer, since struct tail padding naturally protects it,
making the struct a bit smaller.
Size reduction estimation when ARCH_DMA_MINALIGN=128:
- event_list is 32 bytes
- removing _end saves up to 128-32=96 bytes padding to align next field
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
net/vmw_vsock/virtio_transport.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c
index f1589db5d190..2e34581f1143 100644
--- a/net/vmw_vsock/virtio_transport.c
+++ b/net/vmw_vsock/virtio_transport.c
@@ -60,10 +60,7 @@ struct virtio_vsock {
*/
struct mutex event_lock;
bool event_run;
- __dma_from_device_aligned_begin
- struct virtio_vsock_event event_list[8];
- __dma_from_device_aligned_end
u32 guest_cid;
bool seqpacket_allow;
@@ -77,6 +74,10 @@ struct virtio_vsock {
*/
struct scatterlist *out_sgs[MAX_SKB_FRAGS + 1];
struct scatterlist out_bufs[MAX_SKB_FRAGS + 1];
+
+ /* DMA buffer - must be last, aligned for non-cache-coherent DMA */
+ __dma_from_device_aligned_begin
+ struct virtio_vsock_event event_list[8];
};
static u32 virtio_transport_get_local_cid(void)
--
MST