diff options
| author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-09-15 22:58:13 -0400 | 
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2010-09-17 00:58:44 -0400 | 
| commit | cd13539b8bc9ae884e6d8d9374c594adff4304e4 (patch) | |
| tree | 6adc13bc1dfe5da2480f5d2186e2719f5f2b713f | |
| parent | 94767632623c7bf5b16a0cf963ec93a8ad9acca4 (diff) | |
net: shrinks struct net_device
commit ab95bfe01 (net: replace hooks in __netif_receive_skb) added
rx_handler at wrong place, between two cache line aligned objects,
creating a big hole (a full cache line)
Move rx_handler and rx_handler_data before rx_queue, filling existing
hole.
Move master field in the cache line(s) used in receive path.
This saves 64 bytes (or L1_CACHE_BYTES), and avoids two possible
cache misses in receive path.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | include/linux/netdevice.h | 20 | 
1 files changed, 11 insertions, 9 deletions
| diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 8992fffb8104..ec17887a5bca 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
| @@ -918,10 +918,6 @@ struct net_device { | |||
| 918 | unsigned short needed_headroom; | 918 | unsigned short needed_headroom; | 
| 919 | unsigned short needed_tailroom; | 919 | unsigned short needed_tailroom; | 
| 920 | 920 | ||
| 921 | struct net_device *master; /* Pointer to master device of a group, | ||
| 922 | * which this device is member of. | ||
| 923 | */ | ||
| 924 | |||
| 925 | /* Interface address info. */ | 921 | /* Interface address info. */ | 
| 926 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 922 | unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ | 
| 927 | unsigned char addr_assign_type; /* hw address assignment type */ | 923 | unsigned char addr_assign_type; /* hw address assignment type */ | 
| @@ -951,7 +947,7 @@ struct net_device { | |||
| 951 | assign before registering */ | 947 | assign before registering */ | 
| 952 | 948 | ||
| 953 | /* | 949 | /* | 
| 954 | * Cache line mostly used on receive path (including eth_type_trans()) | 950 | * Cache lines mostly used on receive path (including eth_type_trans()) | 
| 955 | */ | 951 | */ | 
| 956 | unsigned long last_rx; /* Time of last Rx | 952 | unsigned long last_rx; /* Time of last Rx | 
| 957 | * This should not be set in | 953 | * This should not be set in | 
| @@ -961,6 +957,10 @@ struct net_device { | |||
| 961 | * avoid dirtying this cache line. | 957 | * avoid dirtying this cache line. | 
| 962 | */ | 958 | */ | 
| 963 | 959 | ||
| 960 | struct net_device *master; /* Pointer to master device of a group, | ||
| 961 | * which this device is member of. | ||
| 962 | */ | ||
| 963 | |||
| 964 | /* Interface address info used in eth_type_trans() */ | 964 | /* Interface address info used in eth_type_trans() */ | 
| 965 | unsigned char *dev_addr; /* hw address, (before bcast | 965 | unsigned char *dev_addr; /* hw address, (before bcast | 
| 966 | because most packets are | 966 | because most packets are | 
| @@ -980,10 +980,14 @@ struct net_device { | |||
| 980 | unsigned int num_rx_queues; | 980 | unsigned int num_rx_queues; | 
| 981 | #endif | 981 | #endif | 
| 982 | 982 | ||
| 983 | struct netdev_queue rx_queue; | ||
| 984 | rx_handler_func_t *rx_handler; | 983 | rx_handler_func_t *rx_handler; | 
| 985 | void *rx_handler_data; | 984 | void *rx_handler_data; | 
| 986 | 985 | ||
| 986 | struct netdev_queue rx_queue; /* use two cache lines */ | ||
| 987 | |||
| 988 | /* | ||
| 989 | * Cache lines mostly used on transmit path | ||
| 990 | */ | ||
| 987 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 991 | struct netdev_queue *_tx ____cacheline_aligned_in_smp; | 
| 988 | 992 | ||
| 989 | /* Number of TX queues allocated at alloc_netdev_mq() time */ | 993 | /* Number of TX queues allocated at alloc_netdev_mq() time */ | 
| @@ -997,9 +1001,7 @@ struct net_device { | |||
| 997 | 1001 | ||
| 998 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | 1002 | unsigned long tx_queue_len; /* Max frames per queue allowed */ | 
| 999 | spinlock_t tx_global_lock; | 1003 | spinlock_t tx_global_lock; | 
| 1000 | /* | 1004 | |
| 1001 | * One part is mostly used on xmit path (device) | ||
| 1002 | */ | ||
| 1003 | /* These may be needed for future network-power-down code. */ | 1005 | /* These may be needed for future network-power-down code. */ | 
| 1004 | 1006 | ||
| 1005 | /* | 1007 | /* | 
