From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>,
Tim Murray <timmurray@google.com>,
Joel Fernandes <joelaf@google.com>,
Neeraj Upadhyay <quic_neeraju@quicinc.com>,
Uladzislau Rezki <urezki@gmail.com>, Todd Kjos <tkjos@google.com>,
Sandeep Patil <sspatil@google.com>,
stable@vger.kernel.org
Subject: [PATCH rcu 09/10] rcu: Don't deboost before reporting expedited quiescent state
Date: Fri, 4 Feb 2022 15:24:05 -0800 [thread overview]
Message-ID: <20220204232406.814-9-paulmck@kernel.org> (raw)
In-Reply-To: <20220204232355.GA728@paulmck-ThinkPad-P17-Gen-1>
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>
---
kernel/rcu/tree_plugin.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index 109429e70a642..02ac057ba3f83 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -556,16 +556,16 @@ rcu_preempt_deferred_qs_irqrestore(struct task_struct *t, unsigned long flags)
raw_spin_unlock_irqrestore_rcu_node(rnp, flags);
}
- /* Unboost if we were boosted. */
- if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex)
- rt_mutex_futex_unlock(&rnp->boost_mtx.rtmutex);
-
/*
* If this was the last task on the expedited lists,
* then we need to report up the rcu_node hierarchy.
*/
if (!empty_exp && empty_exp_now)
rcu_report_exp_rnp(rnp, true);
+
+ /* Unboost if we were boosted. */
+ if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex)
+ rt_mutex_futex_unlock(&rnp->boost_mtx.rtmutex);
} else {
local_irq_restore(flags);
}
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2022-02-04 23:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-04 23:23 [PATCH rcu 0/10] Real-time-related updates for v5.18 Paul E. McKenney
2022-02-04 23:23 ` [PATCH rcu 01/10] rcu: Mark accesses to boost_starttime Paul E. McKenney
2022-02-04 23:23 ` [PATCH rcu 02/10] rcu/nocb: Handle concurrent nocb kthreads creation Paul E. McKenney
2022-02-04 23:23 ` [PATCH rcu 03/10] rcu: Remove unused rcu_state.boost Paul E. McKenney
2022-02-04 23:24 ` [PATCH rcu 04/10] rcu: Create per-cpu rcuc kthreads only when rcutree.use_softirq=0 Paul E. McKenney
2022-02-04 23:24 ` [PATCH rcu 05/10] rcu: Move kthread_prio bounds-check to a separate function Paul E. McKenney
2022-02-04 23:24 ` [PATCH rcu 06/10] rcu: Make priority of grace-period thread consistent Paul E. McKenney
2022-02-04 23:24 ` [PATCH rcu 07/10] rcu: Elevate priority of offloaded callback threads Paul E. McKenney
2022-02-04 23:24 ` [PATCH rcu 08/10] rcu: Update documentation regarding kthread_prio cmdline parameter Paul E. McKenney
2022-02-04 23:24 ` Paul E. McKenney [this message]
2022-02-04 23:24 ` [PATCH rcu 10/10] rcu: Add per-CPU rcuc task dumps to RCU CPU stall warnings Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220204232406.814-9-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=joelaf@google.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_neeraju@quicinc.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sspatil@google.com \
--cc=stable@vger.kernel.org \
--cc=timmurray@google.com \
--cc=tkjos@google.com \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox