summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2015-11-18 06:31:01 -0800
committerAlistair Strachan <astrachan@google.com>2019-01-15 17:08:33 -0800
commit3576d75c8de3d22bc211e563e3263629aaa83502 (patch)
tree89e5ee20006a6287024c28d5c927c4edc55b6af1
parentacb5ff1905fd03fa74ebd07c8df5bcbe80204b79 (diff)
UPSTREAM: 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> (cherry picked from commit 6180d9de61a5c461f9e3efef5417a844701dbbb2) Bug: 121166534 Test: Ran cuttlefish with android-4.4 + VSOCKETS, VMWARE_VMCI_VSOCKETS Signed-off-by: Alistair Strachan <astrachan@google.com> Change-Id: I891b9dfef88c44f6480842754cd7d81e7a250792
-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 @@
struct hlist_head name[1 << (bits)] = \
{ [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
+#define DEFINE_READ_MOSTLY_HASHTABLE(name, bits) \
+ struct hlist_head name[1 << (bits)] __read_mostly = \
+ { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
+
#define DECLARE_HASHTABLE(name, bits) \
struct hlist_head name[1 << (bits)]
diff --git a/net/core/dev.c b/net/core/dev.c
index e03c1d2f6707..d205a3a566b9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -183,7 +183,7 @@ EXPORT_SYMBOL(dev_base_lock);
static DEFINE_SPINLOCK(napi_hash_lock);
static unsigned int napi_gen_id = NR_CPUS;
-static DEFINE_HASHTABLE(napi_hash, 8);
+static DEFINE_READ_MOSTLY_HASHTABLE(napi_hash, 8);
static seqcount_t devnet_rename_seq;