netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] route: move lwtunnel state to a single place
@ 2016-04-22 10:40 Jiri Benc
  2016-04-25 20:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Benc @ 2016-04-22 10:40 UTC (permalink / raw)
  To: netdev; +Cc: Lance Richardson

Commit 751a587ac9f9 ("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>
---
Full analysis here: http://article.gmane.org/gmane.linux.network/375426
---
 include/net/dst.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/net/dst.h b/include/net/dst.h
index 5c98443c1c9e..6835d224d47b 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -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
@@ -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;
-- 
1.8.3.1

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

* Re: [PATCH net-next] route: move lwtunnel state to a single place
  2016-04-22 10:40 [PATCH net-next] route: move lwtunnel state to a single place Jiri Benc
@ 2016-04-25 20:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-04-25 20:20 UTC (permalink / raw)
  To: jbenc; +Cc: netdev, lrichard

From: Jiri Benc <jbenc@redhat.com>
Date: Fri, 22 Apr 2016 12:40:02 +0200

> Commit 751a587ac9f9 ("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>

Fair enough, applied, thanks Jiri.

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

end of thread, other threads:[~2016-04-25 20:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 10:40 [PATCH net-next] route: move lwtunnel state to a single place Jiri Benc
2016-04-25 20:20 ` David Miller

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).