aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/net_namespace.h25
1 files changed, 17 insertions, 8 deletions
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index f8712bbeb2e0..4c2cd9378699 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -52,6 +52,9 @@ struct bpf_prog;
52#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS) 52#define NETDEV_HASHENTRIES (1 << NETDEV_HASHBITS)
53 53
54struct net { 54struct net {
55 /* First cache line can be often dirtied.
56 * Do not place here read-mostly fields.
57 */
55 refcount_t passive; /* To decide when the network 58 refcount_t passive; /* To decide when the network
56 * namespace should be freed. 59 * namespace should be freed.
57 */ 60 */
@@ -60,7 +63,13 @@ struct net {
60 */ 63 */
61 spinlock_t rules_mod_lock; 64 spinlock_t rules_mod_lock;
62 65
63 u32 hash_mix; 66 unsigned int dev_unreg_count;
67
68 unsigned int dev_base_seq; /* protected by rtnl_mutex */
69 int ifindex;
70
71 spinlock_t nsid_lock;
72 atomic_t fnhe_genid;
64 73
65 struct list_head list; /* list of network namespaces */ 74 struct list_head list; /* list of network namespaces */
66 struct list_head exit_list; /* To linked to call pernet exit 75 struct list_head exit_list; /* To linked to call pernet exit
@@ -76,11 +85,11 @@ struct net {
76#endif 85#endif
77 struct user_namespace *user_ns; /* Owning user namespace */ 86 struct user_namespace *user_ns; /* Owning user namespace */
78 struct ucounts *ucounts; 87 struct ucounts *ucounts;
79 spinlock_t nsid_lock;
80 struct idr netns_ids; 88 struct idr netns_ids;
81 89
82 struct ns_common ns; 90 struct ns_common ns;
83 91
92 struct list_head dev_base_head;
84 struct proc_dir_entry *proc_net; 93 struct proc_dir_entry *proc_net;
85 struct proc_dir_entry *proc_net_stat; 94 struct proc_dir_entry *proc_net_stat;
86 95
@@ -93,17 +102,18 @@ struct net {
93 102
94 struct uevent_sock *uevent_sock; /* uevent socket */ 103 struct uevent_sock *uevent_sock; /* uevent socket */
95 104
96 struct list_head dev_base_head;
97 struct hlist_head *dev_name_head; 105 struct hlist_head *dev_name_head;
98 struct hlist_head *dev_index_head; 106 struct hlist_head *dev_index_head;
99 unsigned int dev_base_seq; /* protected by rtnl_mutex */ 107 /* Note that @hash_mix can be read millions times per second,
100 int ifindex; 108 * it is critical that it is on a read_mostly cache line.
101 unsigned int dev_unreg_count; 109 */
110 u32 hash_mix;
111
112 struct net_device *loopback_dev; /* The loopback */
102 113
103 /* core fib_rules */ 114 /* core fib_rules */
104 struct list_head rules_ops; 115 struct list_head rules_ops;
105 116
106 struct net_device *loopback_dev; /* The loopback */
107 struct netns_core core; 117 struct netns_core core;
108 struct netns_mib mib; 118 struct netns_mib mib;
109 struct netns_packet packet; 119 struct netns_packet packet;
@@ -171,7 +181,6 @@ struct net {
171 struct sock *crypto_nlsk; 181 struct sock *crypto_nlsk;
172#endif 182#endif
173 struct sock *diag_nlsk; 183 struct sock *diag_nlsk;
174 atomic_t fnhe_genid;
175} __randomize_layout; 184} __randomize_layout;
176 185
177#include <linux/seq_file_net.h> 186#include <linux/seq_file_net.h>