mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-19 05:04:20 +00:00
sched: Teach might_sleep() about preemptible RCU
In practice, it is harmless to voluntarily sleep in a rcu_read_lock() section if we are running under preempt rcu, but it is illegal if we build a kernel running non-preemptable rcu. Currently, might_sleep() doesn't notice sleepable operations under rcu_read_lock() sections if we are running under preemptable rcu because preempt_count() is left untouched after rcu_read_lock() in this case. But we want developers who test their changes under such config to notice the "sleeping while atomic" issues. So we add rcu_read_lock_nesting to prempt_count() in might_sleep() checks. [ v2: Handle rcu-tiny ] Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Zijlstra <peterz@infradead.org> LKML-Reference: <1260991265-8451-1-git-send-regression-fweisbec@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
416eb39556
commit
234da7bcdc
3 changed files with 17 additions and 1 deletions
|
@ -9682,7 +9682,7 @@ void __init sched_init(void)
|
|||
#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
|
||||
static inline int preempt_count_equals(int preempt_offset)
|
||||
{
|
||||
int nested = preempt_count() & ~PREEMPT_ACTIVE;
|
||||
int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
|
||||
|
||||
return (nested == PREEMPT_INATOMIC_BASE + preempt_offset);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue