Skip to contentSkip to conversation

netfilter: not mark a spinlock as __read_mostly

PATCH Applied Li RongQing 2 participants 2 messages Aug 23, 2019 – Aug 27, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: not mark a spinlock as __read_mostly

when spinlock is locked/unlocked, its elements will be changed, so marking it as __read_mostly is not suitable

and remove a duplicate definition of nf_conntrack_locks_all_lock strange that compiler does not complain

---
 net/netfilter/nf_conntrack_core.c   | 3 +--
 net/netfilter/nf_conntrack_labels.c | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_core.c +1 -2
index 81a8ef42b88d..0c63120b2db2 100644
@@ -73,8 +73,7 @@ struct conntrack_gc_work {
 };
 
 static __read_mostly struct kmem_cache *nf_conntrack_cachep;
-static __read_mostly spinlock_t nf_conntrack_locks_all_lock;
-static __read_mostly DEFINE_SPINLOCK(nf_conntrack_locks_all_lock);
+static DEFINE_SPINLOCK(nf_conntrack_locks_all_lock);
 static __read_mostly bool nf_conntrack_locks_all;
 
 /* every gc cycle scans at most 1/GC_MAX_BUCKETS_DIV part of table */
net/netfilter/nf_conntrack_labels.c +1 -1
index d1c6b2a2e7bd..522792556632 100644
@@ -11,7 +11,7 @@
 #include <net/netfilter/nf_conntrack_ecache.h>
 #include <net/netfilter/nf_conntrack_labels.h>
 
-static __read_mostly DEFINE_SPINLOCK(nf_connlabels_lock);
+static DEFINE_SPINLOCK(nf_connlabels_lock);
 
 static int replace_u32(u32 *address, u32 mask, u32 new)
 {
Signature · 1 line
2.16.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Li RongQing

when spinlock is locked/unlocked, its elements will be changed, so marking it as __read_mostly is not suitable

and remove a duplicate definition of nf_conntrack_locks_all_lock strange that compiler does not complain

Applied, thanks.