Commit 131906b0062ddde7f85bbe67754983c754648bd8
1 parent
b0d304172f
Exists in
master
and in
7 other branches
rcu: decrease rcu_report_exp_rnp coupling with scheduler
PREEMPT_RCU read-side critical sections blocking an expedited grace period invoke rcu_report_exp_rnp(). When the last such critical section has completed, rcu_report_exp_rnp() invokes the scheduler to wake up the task that invoked synchronize_rcu_expedited() -- needlessly holding the root rcu_node structure's lock while doing so, thus needlessly providing a way for RCU and the scheduler to deadlock. This commit therefore releases the root rcu_node structure's lock before calling wake_up(). Reported-by: Ed Tomlinson <edt@aei.ca> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff
kernel/rcutree_plugin.h
... | ... | @@ -695,9 +695,12 @@ |
695 | 695 | |
696 | 696 | raw_spin_lock_irqsave(&rnp->lock, flags); |
697 | 697 | for (;;) { |
698 | - if (!sync_rcu_preempt_exp_done(rnp)) | |
698 | + if (!sync_rcu_preempt_exp_done(rnp)) { | |
699 | + raw_spin_unlock_irqrestore(&rnp->lock, flags); | |
699 | 700 | break; |
701 | + } | |
700 | 702 | if (rnp->parent == NULL) { |
703 | + raw_spin_unlock_irqrestore(&rnp->lock, flags); | |
701 | 704 | wake_up(&sync_rcu_preempt_exp_wq); |
702 | 705 | break; |
703 | 706 | } |
... | ... | @@ -707,7 +710,6 @@ |
707 | 710 | raw_spin_lock(&rnp->lock); /* irqs already disabled */ |
708 | 711 | rnp->expmask &= ~mask; |
709 | 712 | } |
710 | - raw_spin_unlock_irqrestore(&rnp->lock, flags); | |
711 | 713 | } |
712 | 714 | |
713 | 715 | /* |