aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-11-18 09:31:01 -0500
committerDavid S. Miller <davem@davemloft.net>2015-11-18 16:17:42 -0500
commit6180d9de61a5c461f9e3efef5417a844701dbbb2 (patch)
tree721d4b7a92759fe2951844e6a6f8474cb5fccf97
parentd64b5e85bfe2fe4c790abcbd16d9ae32391ddd7e (diff)
net: move napi_hash[] into read mostly section
We do not often add/delete a napi context. Moving napi_hash[] into read mostly section avoids potential false sharing. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/hashtable.h4
-rw-r--r--net/core/dev.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index 519b6e2d769e..661e5c2a8e2a 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -16,6 +16,10 @@
16 struct hlist_head name[1 << (bits)] = \ 16 struct hlist_head name[1 << (bits)] = \
17 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } 17 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
18 18
19#define DEFINE_READ_MOSTLY_HASHTABLE(name, bits) \
20 struct hlist_head name[1 << (bits)] __read_mostly = \
21 { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
22
19#define DECLARE_HASHTABLE(name, bits) \ 23#define DECLARE_HASHTABLE(name, bits) \
20 struct hlist_head name[1 << (bits)] 24 struct hlist_head name[1 << (bits)]
21 25
diff --git a/net/core/dev.c b/net/core/dev.c
index ff58a8bc5e3c..02dfbd91a8e4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -184,7 +184,7 @@ EXPORT_SYMBOL(dev_base_lock);
184static DEFINE_SPINLOCK(napi_hash_lock); 184static DEFINE_SPINLOCK(napi_hash_lock);
185 185
186static unsigned int napi_gen_id = NR_CPUS; 186static unsigned int napi_gen_id = NR_CPUS;
187static DEFINE_HASHTABLE(napi_hash, 8); 187static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8);
188 188
189static seqcount_t devnet_rename_seq; 189static seqcount_t devnet_rename_seq;
190 190