mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-04 13:21:45 +00:00
srcu: Remove checks preventing idle CPUs from calling srcu_read_lock()
SRCU has its own statemachine and no longer relies on normal RCU.
Its read-side critical section can now be used by an offline CPU, so this
commit removes the check and the comments, reverting the SRCU portion
of ff195cb6
(rcu: Warn when srcu_read_lock() is used in an extended
quiescent state).
It also makes the codes match the comments in whatisRCU.txt:
g. Do you need read-side critical sections that are respected
even though they are in the middle of the idle loop, during
user-mode execution, or on an offlined CPU? If so, SRCU is the
only choice that will work for you.
[ paulmck: There is at least one remaining issue, namely use of lockdep
with tracing enabled. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
This commit is contained in:
parent
3bc97a782c
commit
511a0868be
1 changed files with 3 additions and 18 deletions
|
@ -151,25 +151,14 @@ void srcu_barrier(struct srcu_struct *sp);
|
||||||
* Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
|
* Checks debug_lockdep_rcu_enabled() to prevent false positives during boot
|
||||||
* and while lockdep is disabled.
|
* and while lockdep is disabled.
|
||||||
*
|
*
|
||||||
* Note that if the CPU is in the idle loop from an RCU point of view
|
* Note that SRCU is based on its own statemachine and it doesn't
|
||||||
* (ie: that we are in the section between rcu_idle_enter() and
|
* relies on normal RCU, it can be called from the CPU which
|
||||||
* rcu_idle_exit()) then srcu_read_lock_held() returns false even if
|
* is in the idle loop from an RCU point of view or offline.
|
||||||
* the CPU did an srcu_read_lock(). The reason for this is that RCU
|
|
||||||
* ignores CPUs that are in such a section, considering these as in
|
|
||||||
* extended quiescent state, so such a CPU is effectively never in an
|
|
||||||
* RCU read-side critical section regardless of what RCU primitives it
|
|
||||||
* invokes. This state of affairs is required --- we need to keep an
|
|
||||||
* RCU-free window in idle where the CPU may possibly enter into low
|
|
||||||
* power mode. This way we can notice an extended quiescent state to
|
|
||||||
* other CPUs that started a grace period. Otherwise we would delay any
|
|
||||||
* grace period as long as we run in the idle task.
|
|
||||||
*/
|
*/
|
||||||
static inline int srcu_read_lock_held(struct srcu_struct *sp)
|
static inline int srcu_read_lock_held(struct srcu_struct *sp)
|
||||||
{
|
{
|
||||||
if (!debug_lockdep_rcu_enabled())
|
if (!debug_lockdep_rcu_enabled())
|
||||||
return 1;
|
return 1;
|
||||||
if (rcu_is_cpu_idle())
|
|
||||||
return 0;
|
|
||||||
return lock_is_held(&sp->dep_map);
|
return lock_is_held(&sp->dep_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,8 +220,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
|
||||||
int retval = __srcu_read_lock(sp);
|
int retval = __srcu_read_lock(sp);
|
||||||
|
|
||||||
rcu_lock_acquire(&(sp)->dep_map);
|
rcu_lock_acquire(&(sp)->dep_map);
|
||||||
rcu_lockdep_assert(!rcu_is_cpu_idle(),
|
|
||||||
"srcu_read_lock() used illegally while idle");
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,8 +233,6 @@ static inline int srcu_read_lock(struct srcu_struct *sp) __acquires(sp)
|
||||||
static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
|
static inline void srcu_read_unlock(struct srcu_struct *sp, int idx)
|
||||||
__releases(sp)
|
__releases(sp)
|
||||||
{
|
{
|
||||||
rcu_lockdep_assert(!rcu_is_cpu_idle(),
|
|
||||||
"srcu_read_unlock() used illegally while idle");
|
|
||||||
rcu_lock_release(&(sp)->dep_map);
|
rcu_lock_release(&(sp)->dep_map);
|
||||||
__srcu_read_unlock(sp, idx);
|
__srcu_read_unlock(sp, idx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue