Skip to contentSkip to conversation

mux: Realign struct mux_chip to save 8 bytes

PATCH Superseded Thorsten Blum 1 participant 1 message Jun 19, 2025 Multiplexer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mux: Realign struct mux_chip to save 8 bytes

Reduce mux_chip's struct size by 8 bytes by realigning its members.

pahole output before:

/* size: 752, cachelines: 12, members: 5 */ /* sum members: 744, holes: 2, sum holes: 8 */ /* member types with bit paddings: 1, total: 1 bit */ /* paddings: 1, sum paddings: 3 */
/* last cacheline: 48 bytes */

and after:

/* size: 744, cachelines: 12, members: 5 */ /* member types with bit paddings: 1, total: 1 bit */ /* paddings: 1, sum paddings: 3 */
/* last cacheline: 40 bytes */

---
 include/linux/mux/driver.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/mux/driver.h +2 -3
index e58e59354e23..8e912399cf3b 100644
@@ -56,16 +56,15 @@ struct mux_control {
 /**
  * struct mux_chip -	Represents a chip holding mux controllers.
  * @controllers:	Number of mux controllers handled by the chip.
- * @dev:		Device structure.
  * @id:			Used to identify the device internally.
+ * @dev:		Device structure.
  * @ops:		Mux controller operations.
  * @mux:		Array of mux controllers that are handled.
  */
 struct mux_chip {
 	unsigned int controllers;
-	struct device dev;
 	int id;
-
+	struct device dev;
 	const struct mux_control_ops *ops;
 	struct mux_control mux[] __counted_by(controllers);
 };
Signature · 1 line
2.48.1