aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2010-03-31 18:24:22 -0400
committerDavid S. Miller <davem@davemloft.net>2010-04-01 21:41:41 -0400
commitbd2c77a0a749589b45f2697ea446a4438d078f9b (patch)
tree801d2f87cad4bd6bafd946ad4eb16cb1c0db779b
parent152102c7f2bf191690f1069bae292ea3925adf14 (diff)
ipv6 fib: Make rt6_info{} more cache-line aware.
The head element of rt6_info{} is dst_entry{}, and IPv6 specific elements follow. Because elements at the end of dst_entry{} are frequently updated, it is not good to put frequently-used static elements, such as rt6i_idev, rt6i_dst or rt6i_flags in the same cache line. On the other hand, fib6_table, rt6i_node or rt6i_gateway are rarely used, so it is okay to stay in the same cache line. Let's rearrange rt6_info{}. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/ip6_fib.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 86f46c49e318..4b1dc1161c37 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -88,34 +88,37 @@ struct rt6_info {
88 struct dst_entry dst; 88 struct dst_entry dst;
89 } u; 89 } u;
90 90
91 struct inet6_dev *rt6i_idev;
92
93#define rt6i_dev u.dst.dev 91#define rt6i_dev u.dst.dev
94#define rt6i_nexthop u.dst.neighbour 92#define rt6i_nexthop u.dst.neighbour
95#define rt6i_expires u.dst.expires 93#define rt6i_expires u.dst.expires
96 94
95 /*
96 * Tail elements of dst_entry (__refcnt etc.)
97 * and these elements (rarely used in hot path) are in
98 * the same cache line.
99 */
100 struct fib6_table *rt6i_table;
97 struct fib6_node *rt6i_node; 101 struct fib6_node *rt6i_node;
98 102
99 struct in6_addr rt6i_gateway; 103 struct in6_addr rt6i_gateway;
100
101 u32 rt6i_flags;
102 u32 rt6i_metric;
103 atomic_t rt6i_ref;
104 104
105 /* more non-fragment space at head required */ 105 atomic_t rt6i_ref;
106 unsigned short rt6i_nfheader_len;
107
108 u8 rt6i_protocol;
109 106
110 struct fib6_table *rt6i_table; 107 /* These are in a separate cache line. */
108 struct rt6key rt6i_dst ____cacheline_aligned_in_smp;
109 u32 rt6i_flags;
110 struct rt6key rt6i_src;
111 u32 rt6i_metric;
111 112
112 struct rt6key rt6i_dst; 113 struct inet6_dev *rt6i_idev;
113 114
114#ifdef CONFIG_XFRM 115#ifdef CONFIG_XFRM
115 u32 rt6i_flow_cache_genid; 116 u32 rt6i_flow_cache_genid;
116#endif 117#endif
118 /* more non-fragment space at head required */
119 unsigned short rt6i_nfheader_len;
117 120
118 struct rt6key rt6i_src; 121 u8 rt6i_protocol;
119}; 122};
120 123
121static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) 124static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)