Skip to content

Commit 1e19e02

Browse files
Eric DumazetDavid S. Miller
authored andcommitted
[NET]: Reorder fields of struct dst_entry
This last patch (but not least :) ) finally moves the next pointer at the end of struct dst_entry. This permits to perform route cache lookups with a minimal cost of one cache line per entry, instead of two. Both 32bits and 64bits platforms benefit from this new layout. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0c195c3 commit 1e19e02

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎include/net/dst.h‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,7 @@ struct sk_buff;
3737

3838
struct dst_entry
3939
{
40-
union {
41-
struct dst_entry *next;
42-
struct rtable *rt_next;
43-
struct rt6_info *rt6_next;
44-
struct dn_route *dn_next;
45-
};
46-
atomic_t __refcnt; /* client references */
47-
int __use;
40+
struct rcu_head rcu_head;
4841
struct dst_entry *child;
4942
struct net_device *dev;
5043
short error;
@@ -55,7 +48,6 @@ struct dst_entry
5548
#define DST_NOPOLICY 4
5649
#define DST_NOHASH 8
5750
#define DST_BALANCED 0x10
58-
unsigned long lastuse;
5951
unsigned long expires;
6052

6153
unsigned short header_len; /* more space at head required */
@@ -80,8 +72,16 @@ struct dst_entry
8072
#endif
8173

8274
struct dst_ops *ops;
83-
struct rcu_head rcu_head;
8475

76+
unsigned long lastuse;
77+
atomic_t __refcnt; /* client references */
78+
int __use;
79+
union {
80+
struct dst_entry *next;
81+
struct rtable *rt_next;
82+
struct rt6_info *rt6_next;
83+
struct dn_route *dn_next;
84+
};
8585
char info[0];
8686
};
8787

0 commit comments

Comments
 (0)