Blob Blame History Raw
From 4fe3997a68f3300c73adc196ff33a952febe6974 Mon Sep 17 00:00:00 2001
From: Chris Wilson <chris@chris-wilson.co.uk>
Date: Sat, 17 Aug 2019 15:47:33 +0100
Subject: dma-fence: Shrink size of struct dma_fence
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Git-commit: 4fe3997a68f3300c73adc196ff33a952febe6974
Patch-mainline: v5.4-rc1
References: bsc#1152472

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@chris-wilson.co.uk>
Cc: Christian König <christian.koenig@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190817144736.7826-3-chris@chris-wilson.co.uk
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 include/linux/dma-fence.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h
index 404aa748eda6..2ce4d877d33e 100644
--- a/include/linux/dma-fence.h
+++ b/include/linux/dma-fence.h
@@ -63,7 +63,7 @@ struct dma_fence_cb;
  * been completed, or never called at all.
  */
 struct dma_fence {
-	struct kref refcount;
+	spinlock_t *lock;
 	const struct dma_fence_ops *ops;
 	/* 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
@@ -73,11 +73,11 @@ struct dma_fence {
 		struct rcu_head rcu;
 		struct list_head cb_list;
 	};
-	spinlock_t *lock;
 	u64 context;
 	u64 seqno;
-	unsigned long flags;
 	ktime_t timestamp;
+	unsigned long flags;
+	struct kref refcount;
 	int error;
 };
 
-- 
2.28.0