Patchwork [net-next] net: keep name_hlist close to name

login
register
mail settings
Submitter Eric Dumazet
Date June 11, 2012, 4:36 p.m.
Message ID <1339432573.6001.2429.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/164227/
State Accepted
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - June 11, 2012, 4:36 p.m.
From: Eric Dumazet <edumazet@google.com>

__dev_get_by_name() is slow because pm_qos_req has been inserted between
name[] and name_hlist, adding cache misses.

pm_qos_req has nothing to do at the beginning of struct net_device

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/netdevice.h |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)



--
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 - June 11, 2012, 8:11 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 11 Jun 2012 18:36:13 +0200

> From: Eric Dumazet <edumazet@google.com>
> 
> __dev_get_by_name() is slow because pm_qos_req has been inserted between
> name[] and name_hlist, adding cache misses.
> 
> pm_qos_req has nothing to do at the beginning of struct net_device
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks.
--
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

Patch

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d94cb14..a0b84e3 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1046,10 +1046,9 @@  struct net_device {
 	 */
 	char			name[IFNAMSIZ];
 
-	struct pm_qos_request	pm_qos_req;
-
-	/* device name hash chain */
+	/* device name hash chain, please keep it close to name[] */
 	struct hlist_node	name_hlist;
+
 	/* snmp alias */
 	char 			*ifalias;
 
@@ -1322,6 +1321,8 @@  struct net_device {
 
 	/* group the device belongs to */
 	int group;
+
+	struct pm_qos_request	pm_qos_req;
 };
 #define to_net_dev(d) container_of(d, struct net_device, dev)