From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
fweisbec@gmail.com, urezki@gmail.com
Subject: [PATCH v2 rcu/dev 2/2] rcu: Disable laziness if lazy-tracking says so
Date: Thu, 12 Jan 2023 00:52:23 +0000 [thread overview]
Message-ID: <20230112005223.2329802-2-joel@joelfernandes.org> (raw)
In-Reply-To: <20230112005223.2329802-1-joel@joelfernandes.org>
During suspend, we see failures to suspend 1 in 300-500 suspends.
Looking closer, it appears that asynchronous RCU callbacks are being
queued as lazy even though synchronous callbacks are expedited. These
delays appear to not be very welcome by the suspend/resume code as
evidenced by these occasional suspend failures.
This commit modifies call_rcu() to check if rcu_async_should_hurry(),
which will return true if we are in suspend or in-kernel boot.
Ignoring the lazy hint makes the 3000 suspend/resume cycles pass
reliably on a 12th gen 12-core Intel CPU, and there is some evidence
that it also slightly speeds up boot performance.
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
kernel/rcu/tree.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 78b2e999c904..c71e38d7815a 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2594,12 +2594,12 @@ static void check_cb_ovld(struct rcu_data *rdp)
}
static void
-__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy)
+__call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
{
static atomic_t doublefrees;
unsigned long flags;
struct rcu_data *rdp;
- bool was_alldone;
+ bool was_alldone, lazy;
/* Misaligned rcu_head! */
WARN_ON_ONCE((unsigned long)head & (sizeof(void *) - 1));
@@ -2622,6 +2622,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy)
kasan_record_aux_stack_noalloc(head);
local_irq_save(flags);
rdp = this_cpu_ptr(&rcu_data);
+ lazy = lazy_in && !rcu_async_should_hurry();
/* Add the callback to our list. */
if (unlikely(!rcu_segcblist_is_enabled(&rdp->cblist))) {
--
2.39.0.314.g84b9a713c41-goog
next prev parent reply other threads:[~2023-01-12 0:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 0:52 [PATCH v2 rcu/dev 1/2] rcu: Track laziness during boot and suspend Joel Fernandes (Google)
2023-01-12 0:52 ` Joel Fernandes (Google) [this message]
2023-01-15 20:54 ` [PATCH v2 rcu/dev 2/2] rcu: Disable laziness if lazy-tracking says so Steven Rostedt
2023-01-15 21:29 ` Joel Fernandes
2023-01-12 1:29 ` [PATCH v2 rcu/dev 1/2] rcu: Track laziness during boot and suspend Paul E. McKenney
2023-01-12 1:56 ` Joel Fernandes
2023-01-12 19:27 ` Paul E. McKenney
2023-01-12 22:25 ` Joel Fernandes
2023-01-12 23:50 ` Paul E. McKenney
2023-01-15 21:25 ` Steven Rostedt
2023-01-15 21:34 ` Joel Fernandes
2023-01-16 4:26 ` Paul E. McKenney
2023-01-17 19:32 ` Steven Rostedt
2023-01-17 19:37 ` Paul E. McKenney
2023-01-17 19:45 ` Joel Fernandes
2023-01-17 21:40 ` Steven Rostedt
2023-01-18 3:51 ` 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=20230112005223.2329802-2-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--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
all inboxes | Powered by JetHome®