summaryrefslogtreecommitdiff
path: root/include/net/net_namespace.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-10-14 09:56:18 +0400
committerDavid S. Miller <davem@davemloft.net>2010-10-18 00:49:14 +0400
commit8e602ce2980fd6941dc0d3dda12e5095e8206f34 (patch)
tree1a0ea79a6db1b01660cc034c822d02c95e356388 /include/net/net_namespace.h
parentc60ce4e265404ca42ba860401f4b0f1e97332a67 (diff)
downloadlinux-8e602ce2980fd6941dc0d3dda12e5095e8206f34.tar.xz
netns: reorder fields in struct net
In a network bench, I noticed an unfortunate false sharing between 'loopback_dev' and 'count' fields in "struct net". 'count' is written each time a socket is created or destroyed, while loopback_dev might be often read in routing code. Move loopback_dev in a read mostly section of "struct net" Note: struct netns_xfrm is cache line aligned on SMP. (It contains a "struct dst_ops") Move it at the end to avoid holes, and reduce sizeof(struct net) by 128 bytes on ia32. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/net_namespace.h')
-rw-r--r--include/net/net_namespace.h17
1 files changed, 10 insertions, 7 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index bd10a7908993..65af9a07cf76 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -41,6 +41,8 @@ struct net {
* destroy on demand
*/
#endif
+ spinlock_t rules_mod_lock;
+
struct list_head list; /* list of network namespaces */
struct list_head cleanup_list; /* namespaces on death row */
struct list_head exit_list; /* Use only net_mutex */
@@ -52,7 +54,8 @@ struct net {
struct ctl_table_set sysctls;
#endif
- struct net_device *loopback_dev; /* The loopback */
+ struct sock *rtnl; /* rtnetlink socket */
+ struct sock *genl_sock;
struct list_head dev_base_head;
struct hlist_head *dev_name_head;
@@ -60,11 +63,9 @@ struct net {
/* core fib_rules */
struct list_head rules_ops;
- spinlock_t rules_mod_lock;
- struct sock *rtnl; /* rtnetlink socket */
- struct sock *genl_sock;
+ struct net_device *loopback_dev; /* The loopback */
struct netns_core core;
struct netns_mib mib;
struct netns_packet packet;
@@ -84,13 +85,15 @@ struct net {
struct sock *nfnl;
struct sock *nfnl_stash;
#endif
-#ifdef CONFIG_XFRM
- struct netns_xfrm xfrm;
-#endif
#ifdef CONFIG_WEXT_CORE
struct sk_buff_head wext_nlevents;
#endif
struct net_generic *gen;
+
+ /* Note : following structs are cache line aligned */
+#ifdef CONFIG_XFRM
+ struct netns_xfrm xfrm;
+#endif
};