netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Patch net-next] tcp_metrics: rearrange fields to avoid holes
@ 2013-07-31  2:48 Cong Wang
  2013-07-31  3:08 ` Eric Dumazet
  0 siblings, 1 reply; 12+ messages in thread
From: Cong Wang @ 2013-07-31  2:48 UTC (permalink / raw)
  To: netdev
  Cc: David S. Miller, Eric Dumazet, Yuchung Cheng, Neal Cardwell,
	Cong Wang

From: Cong Wang <amwang@redhat.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@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <amwang@redhat.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 {

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-08-01  8:14 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-31  2:48 [Patch net-next] tcp_metrics: rearrange fields to avoid holes Cong Wang
2013-07-31  3:08 ` Eric Dumazet
2013-07-31  3:13   ` Cong Wang
2013-07-31  3:24     ` Eric Dumazet
2013-07-31  3:35       ` Joe Perches
2013-07-31  3:40         ` Cong Wang
2013-07-31  3:37       ` Cong Wang
2013-07-31  3:57         ` Eric Dumazet
2013-07-31  6:26     ` David Miller
2013-08-01  2:48       ` Cong Wang
2013-08-01  7:15         ` David Miller
2013-08-01  8:13           ` Cong Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).