net: keep name_hlist close to name

__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>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2012-06-11 06:36:13 +00:00 committed by David S. Miller
parent 67da255210
commit 9136461ab9
1 changed files with 4 additions and 3 deletions

View File

@ -1046,10 +1046,9 @@ struct net_device {
*/ */
char name[IFNAMSIZ]; char name[IFNAMSIZ];
struct pm_qos_request pm_qos_req; /* device name hash chain, please keep it close to name[] */
/* device name hash chain */
struct hlist_node name_hlist; struct hlist_node name_hlist;
/* snmp alias */ /* snmp alias */
char *ifalias; char *ifalias;
@ -1322,6 +1321,8 @@ struct net_device {
/* group the device belongs to */ /* group the device belongs to */
int group; int group;
struct pm_qos_request pm_qos_req;
}; };
#define to_net_dev(d) container_of(d, struct net_device, dev) #define to_net_dev(d) container_of(d, struct net_device, dev)