Commit 7be7f0be907224445acc62b3884c892f38b7ff40
Committed by
Paul E. McKenney
1 parent
7db74df88b
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
rcu: Move rcu_barrier_mutex to rcu_state structure
In order to allow each RCU flavor to concurrently execute its rcu_barrier() function, it is necessary to move the relevant state to the rcu_state structure. This commit therefore moves the rcu_barrier_mutex global variable to a new ->barrier_mutex field in the rcu_state structure. Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Showing 2 changed files with 4 additions and 6 deletions Side-by-side Diff
kernel/rcutree.c
... | ... | @@ -71,6 +71,7 @@ |
71 | 71 | .onofflock = __RAW_SPIN_LOCK_UNLOCKED(&sname##_state.onofflock), \ |
72 | 72 | .orphan_nxttail = &sname##_state.orphan_nxtlist, \ |
73 | 73 | .orphan_donetail = &sname##_state.orphan_donelist, \ |
74 | + .barrier_mutex = __MUTEX_INITIALIZER(sname##_state.barrier_mutex), \ | |
74 | 75 | .fqslock = __RAW_SPIN_LOCK_UNLOCKED(&sname##_state.fqslock), \ |
75 | 76 | .n_force_qs = 0, \ |
76 | 77 | .n_force_qs_ngp = 0, \ |
... | ... | @@ -155,10 +156,6 @@ |
155 | 156 | unsigned long rcutorture_testseq; |
156 | 157 | unsigned long rcutorture_vernum; |
157 | 158 | |
158 | -/* State information for rcu_barrier() and friends. */ | |
159 | - | |
160 | -static DEFINE_MUTEX(rcu_barrier_mutex); | |
161 | - | |
162 | 159 | /* |
163 | 160 | * Return true if an RCU grace period is in progress. The ACCESS_ONCE()s |
164 | 161 | * permit this function to be invoked without holding the root rcu_node |
... | ... | @@ -2303,7 +2300,7 @@ |
2303 | 2300 | init_rcu_head_on_stack(&rd.barrier_head); |
2304 | 2301 | |
2305 | 2302 | /* Take mutex to serialize concurrent rcu_barrier() requests. */ |
2306 | - mutex_lock(&rcu_barrier_mutex); | |
2303 | + mutex_lock(&rsp->barrier_mutex); | |
2307 | 2304 | |
2308 | 2305 | smp_mb(); /* Prevent any prior operations from leaking in. */ |
2309 | 2306 | |
... | ... | @@ -2380,7 +2377,7 @@ |
2380 | 2377 | wait_for_completion(&rsp->barrier_completion); |
2381 | 2378 | |
2382 | 2379 | /* Other rcu_barrier() invocations can now safely proceed. */ |
2383 | - mutex_unlock(&rcu_barrier_mutex); | |
2380 | + mutex_unlock(&rsp->barrier_mutex); | |
2384 | 2381 | |
2385 | 2382 | destroy_rcu_head_on_stack(&rd.barrier_head); |
2386 | 2383 | } |
kernel/rcutree.h
... | ... | @@ -400,6 +400,7 @@ |
400 | 400 | struct task_struct *rcu_barrier_in_progress; |
401 | 401 | /* Task doing rcu_barrier(), */ |
402 | 402 | /* or NULL if no barrier. */ |
403 | + struct mutex barrier_mutex; /* Guards barrier fields. */ | |
403 | 404 | atomic_t barrier_cpu_count; /* # CPUs waiting on. */ |
404 | 405 | struct completion barrier_completion; /* Wake at barrier end. */ |
405 | 406 | raw_spinlock_t fqslock; /* Only one task forcing */ |