Skip to content

Commit fcc9797

Browse files
paulmckrcugregkh
authored andcommitted
rcu: Don't deboost before reporting expedited quiescent state
commit 10c5357 upstream. Currently rcu_preempt_deferred_qs_irqrestore() releases rnp->boost_mtx before reporting the expedited quiescent state. Under heavy real-time load, this can result in this function being preempted before the quiescent state is reported, which can in turn prevent the expedited grace period from completing. Tim Murray reports that the resulting expedited grace periods can take hundreds of milliseconds and even more than one second, when they should normally complete in less than a millisecond. This was fine given that there were no particular response-time constraints for synchronize_rcu_expedited(), as it was designed for throughput rather than latency. However, some users now need sub-100-millisecond response-time constratints. This patch therefore follows Neeraj's suggestion (seconded by Tim and by Uladzislau Rezki) of simply reversing the two operations. Reported-by: Tim Murray <timmurray@google.com> Reported-by: Joel Fernandes <joelaf@google.com> Reported-by: Neeraj Upadhyay <quic_neeraju@quicinc.com> Reviewed-by: Neeraj Upadhyay <quic_neeraju@quicinc.com> Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com> Tested-by: Tim Murray <timmurray@google.com> Cc: Todd Kjos <tkjos@google.com> Cc: Sandeep Patil <sspatil@google.com> Cc: <stable@vger.kernel.org> # 5.4.x Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 87f7ed7 commit fcc9797

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

kernel/rcu/tree_plugin.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,16 +531,17 @@ rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags)
531531
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
532532
}
533533

534-
/* Unboost if we were boosted. */
535-
if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex)
536-
rt_mutex_futex_unlock(&rnp->boost_mtx);
537-
538534
/*
539535
* If this was the last task on the expedited lists,
540536
* then we need to report up the rcu_node hierarchy.
541537
*/
542538
if (!empty_exp && empty_exp_now)
543539
rcu_report_exp_rnp(rnp, true);
540+
541+
/* Unboost if we were boosted. */
542+
if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex)
543+
rt_mutex_futex_unlock(&rnp->boost_mtx);
544+
544545
} else {
545546
local_irq_restore(flags);
546547
}

0 commit comments

Comments
 (0)