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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1375238905-6423-1-git-send-email-amwang@redhat.com>
Date:	Wed, 31 Jul 2013 10:48:25 +0800
From:	Cong Wang <amwang@...hat.com>
To:	netdev@...r.kernel.org
Cc:	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Yuchung Cheng <ycheng@...gle.com>,
	Neal Cardwell <ncardwell@...gle.com>,
	Cong Wang <amwang@...hat.com>
Subject: [Patch net-next] tcp_metrics: rearrange fields to avoid holes

From: Cong Wang <amwang@...hat.com>

On x86_64, before this patch:

struct tcp_fastopen_metrics {
	u16                        mss;                  /*     0     2 */
	u16                        syn_loss:10;          /*     2: 6  2 */

	/* XXX 6 bits hole, try to pack */
	/* XXX 4 bytes hole, try to pack */

	long unsigned int          last_syn_loss;        /*     8     8 */
	struct tcp_fastopen_cookie cookie;               /*    16    17 */

	/* size: 40, cachelines: 1, members: 4 */
	/* sum members: 29, holes: 1, sum holes: 4 */
	/* bit holes: 1, sum bit holes: 6 bits */
	/* padding: 7 */
	/* last cacheline: 40 bytes */
};

after this patch:

struct tcp_fastopen_metrics {
	u16                        mss;                  /*     0     2 */
	u16                        syn_loss:10;          /*     2: 6  2 */

	/* XXX 6 bits hole, try to pack */

	struct tcp_fastopen_cookie cookie;               /*     4    17 */

	/* XXX 3 bytes hole, try to pack */

	long unsigned int          last_syn_loss;        /*    24     8 */

	/* size: 32, cachelines: 1, members: 4 */
	/* sum members: 29, holes: 1, sum holes: 3 */
	/* bit holes: 1, sum bit holes: 6 bits */
	/* last cacheline: 32 bytes */
};

On 32bit, the 4-byte hole should not exist, so this patch probably
doesn't change anything.

Cc: Eric Dumazet <edumazet@...gle.com>
Cc: Yuchung Cheng <ycheng@...gle.com>
Cc: Neal Cardwell <ncardwell@...gle.com>
Cc: David S. Miller <davem@...emloft.net>
Signed-off-by: Cong Wang <amwang@...hat.com>

---
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c
index 10b3796..438393f 100644
--- a/net/ipv4/tcp_metrics.c
+++ b/net/ipv4/tcp_metrics.c
@@ -25,8 +25,8 @@ int sysctl_tcp_nometrics_save __read_mostly;
 struct tcp_fastopen_metrics {
 	u16	mss;
 	u16	syn_loss:10;		/* Recurring Fast Open SYN losses */
-	unsigned long	last_syn_loss;	/* Last Fast Open SYN loss */
 	struct	tcp_fastopen_cookie	cookie;
+	unsigned long	last_syn_loss;	/* Last Fast Open SYN loss */
 };
 
 struct tcp_metrics_block {
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ