Skip to content

Commit 91b5984

Browse files
Sebastian Andrzej SiewiorTiejun Chen
Sebastian Andrzej Siewior
authored and
Tiejun Chen
committed
RCU: we need to skip that warning but only on sleeping locks
This check is okay for upstream. On RT we trigger this while blocking on sleeping lock. In this case, it is okay to schedule() within a RCU section. Since spin_lock() and read_lock() disables migration it should be okay to test for this as an indication whether or not a sleeping lock is held. The ->pi_blocked_on member won't work becasuse it might also be set on regular mutexes. Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
1 parent e799320 commit 91b5984

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kernel/rcu/tree_plugin.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,13 @@ static void rcu_preempt_note_context_switch(bool preempt)
323323
struct task_struct *t = current;
324324
struct rcu_data *rdp;
325325
struct rcu_node *rnp;
326+
int mg_counter = 0;
326327

327328
RCU_LOCKDEP_WARN(!irqs_disabled(), "rcu_preempt_note_context_switch() invoked with interrupts enabled!!!\n");
328-
WARN_ON_ONCE(!preempt && t->rcu_read_lock_nesting > 0);
329+
#if defined(CONFIG_PREEMPT_COUNT) && defined(CONFIG_SMP)
330+
mg_counter = t->migrate_disable;
331+
#endif
332+
WARN_ON_ONCE(!preempt && t->rcu_read_lock_nesting > 0 && !mg_counter);
329333
if (t->rcu_read_lock_nesting > 0 &&
330334
!t->rcu_read_unlock_special.b.blocked) {
331335

0 commit comments

Comments
 (0)