lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250619140359.167685-2-thorsten.blum@linux.dev>
Date: Thu, 19 Jun 2025 16:03:56 +0200
From: Thorsten Blum <thorsten.blum@...ux.dev>
To: Peter Rosin <peda@...ntia.se>,
	Thorsten Blum <thorsten.blum@...ux.dev>,
	Kees Cook <kees@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] 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 */

Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
---
 include/linux/mux/driver.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/linux/mux/driver.h b/include/linux/mux/driver.h
index e58e59354e23..8e912399cf3b 100644
--- a/include/linux/mux/driver.h
+++ b/include/linux/mux/driver.h
@@ -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);
 };
-- 
2.48.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ