Skip to content

Commit

Permalink
route: move lwtunnel state to a single place
Browse files Browse the repository at this point in the history
Commit 751a587 ("route: fix breakage after moving lwtunnel state")
moved lwtstate to the end of dst_entry for 32bit archs. This makes it share
the cacheline with __refcnt which had an unkown effect on performance. For
this reason, the pointer was kept in place for 64bit archs.

However, later performance measurements showed this is of no concern. It
turns out that every performance sensitive path that accesses lwtstate
accesses also struct rtable or struct rt6_info which share the same cache
line.

Thus, to get rid of a few #ifdefs, move the field to the end of the struct
also for 64bit.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Benc authored and David S. Miller committed Apr 25, 2016
1 parent 6a025a5 commit 0868e25
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/net/dst.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,11 @@ struct dst_entry {
#endif

#ifdef CONFIG_64BIT
struct lwtunnel_state *lwtstate;
/*
* Align __refcnt to a 64 bytes alignment
* (L1_CACHE_SIZE would be too much)
*/
long __pad_to_align_refcnt[1];
long __pad_to_align_refcnt[2];
#endif
/*
* __refcnt wants to be on a different cache line from
Expand All @@ -99,9 +98,7 @@ struct dst_entry {
atomic_t __refcnt; /* client references */
int __use;
unsigned long lastuse;
#ifndef CONFIG_64BIT
struct lwtunnel_state *lwtstate;
#endif
union {
struct dst_entry *next;
struct rtable __rcu *rt_next;
Expand Down

0 comments on commit 0868e25

Please sign in to comment.