diff mbox

[net-next] sctp: Pack dst_cookie into 1st cacheline hole for 64bit host

Message ID 1375693983-22824-1-git-send-email-fan.du@windriver.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

fan.du Aug. 5, 2013, 9:13 a.m. UTC
As dst_cookie is used in fast path sctp_transport_dst_check.

Before:
struct sctp_transport {
	struct list_head           transports;           /*     0    16 */
	atomic_t                   refcnt;               /*    16     4 */
	__u32                      dead:1;               /*    20:31  4 */
	__u32                      rto_pending:1;        /*    20:30  4 */
	__u32                      hb_sent:1;            /*    20:29  4 */
	__u32                      pmtu_pending:1;       /*    20:28  4 */

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

	__u32                      sack_generation;      /*    24     4 */

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

	struct flowi               fl;                   /*    32    64 */
	/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
	union sctp_addr            ipaddr;               /*    96    28 */

After:
struct sctp_transport {
	struct list_head           transports;           /*     0    16 */
	atomic_t                   refcnt;               /*    16     4 */
	__u32                      dead:1;               /*    20:31  4 */
	__u32                      rto_pending:1;        /*    20:30  4 */
	__u32                      hb_sent:1;            /*    20:29  4 */
	__u32                      pmtu_pending:1;       /*    20:28  4 */

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

	__u32                      sack_generation;      /*    24     4 */
	u32                        dst_cookie;           /*    28     4 */
	struct flowi               fl;                   /*    32    64 */
	/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
	union sctp_addr            ipaddr;               /*    96    28 */

Signed-off-by: Fan Du <fan.du@windriver.com>
---
 include/net/sctp/structs.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Neil Horman Aug. 5, 2013, 11:42 a.m. UTC | #1
On Mon, Aug 05, 2013 at 05:13:03PM +0800, Fan Du wrote:
> As dst_cookie is used in fast path sctp_transport_dst_check.
> 
> Before:
> struct sctp_transport {
> 	struct list_head           transports;           /*     0    16 */
> 	atomic_t                   refcnt;               /*    16     4 */
> 	__u32                      dead:1;               /*    20:31  4 */
> 	__u32                      rto_pending:1;        /*    20:30  4 */
> 	__u32                      hb_sent:1;            /*    20:29  4 */
> 	__u32                      pmtu_pending:1;       /*    20:28  4 */
> 
> 	/* XXX 28 bits hole, try to pack */
> 
> 	__u32                      sack_generation;      /*    24     4 */
> 
> 	/* XXX 4 bytes hole, try to pack */
> 
> 	struct flowi               fl;                   /*    32    64 */
> 	/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
> 	union sctp_addr            ipaddr;               /*    96    28 */
> 
> After:
> struct sctp_transport {
> 	struct list_head           transports;           /*     0    16 */
> 	atomic_t                   refcnt;               /*    16     4 */
> 	__u32                      dead:1;               /*    20:31  4 */
> 	__u32                      rto_pending:1;        /*    20:30  4 */
> 	__u32                      hb_sent:1;            /*    20:29  4 */
> 	__u32                      pmtu_pending:1;       /*    20:28  4 */
> 
> 	/* XXX 28 bits hole, try to pack */
> 
> 	__u32                      sack_generation;      /*    24     4 */
> 	u32                        dst_cookie;           /*    28     4 */
> 	struct flowi               fl;                   /*    32    64 */
> 	/* --- cacheline 1 boundary (64 bytes) was 32 bytes ago --- */
> 	union sctp_addr            ipaddr;               /*    96    28 */
> 
> Signed-off-by: Fan Du <fan.du@windriver.com>
> ---
>  include/net/sctp/structs.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
> index c0f4e29..d9c93a7 100644
> --- a/include/net/sctp/structs.h
> +++ b/include/net/sctp/structs.h
> @@ -782,6 +782,7 @@ struct sctp_transport {
>  
>  	/* Has this transport moved the ctsn since we last sacked */
>  	__u32 sack_generation;
> +	u32 dst_cookie;
>  
>  	struct flowi fl;
>  
> @@ -946,7 +947,6 @@ struct sctp_transport {
>  	__u64 hb_nonce;
>  
>  	struct rcu_head rcu;
> -	u32 dst_cookie;
>  };
>  
>  struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,
> -- 
> 1.7.9.5
> 
> 

Acked-by: Neil Horman <nhorman@tuxdriver.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Aug. 5, 2013, 7:21 p.m. UTC | #2
From: Fan Du <fan.du@windriver.com>
Date: Mon, 5 Aug 2013 17:13:03 +0800

> As dst_cookie is used in fast path sctp_transport_dst_check.
 ...
> Signed-off-by: Fan Du <fan.du@windriver.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index c0f4e29..d9c93a7 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -782,6 +782,7 @@  struct sctp_transport {
 
 	/* Has this transport moved the ctsn since we last sacked */
 	__u32 sack_generation;
+	u32 dst_cookie;
 
 	struct flowi fl;
 
@@ -946,7 +947,6 @@  struct sctp_transport {
 	__u64 hb_nonce;
 
 	struct rcu_head rcu;
-	u32 dst_cookie;
 };
 
 struct sctp_transport *sctp_transport_new(struct net *, const union sctp_addr *,