From: Joel Fernandes <joel@joelfernandes.org>
To: paulmck@kernel.org
Cc: linux-kernel@vger.kernel.org,
Josh Triplett <josh@joshtriplett.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
rcu@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
foo@bar.com
Subject: Re: [PATCH -rcu] rcu: Disable lazy if call_rcu() called when GPs expedited
Date: Mon, 9 Jan 2023 18:20:55 -0500 [thread overview]
Message-ID: <C461EF52-B060-4871-8C20-30824983E787@joelfernandes.org> (raw)
In-Reply-To: <20230109231416.GA4028633@paulmck-ThinkPad-P17-Gen-1>
> On Jan 9, 2023, at 6:14 PM, Paul E. McKenney <paulmck@kernel.org> wrote:
>
> On Mon, Jan 09, 2023 at 10:17:56PM +0000, Joel Fernandes (Google) wrote:
>> During suspend, we see failures to suspend 1 in 300-500 suspends.
>> Looking closer, it appears that we are queuing lazy callbacks even
>> though rcu_gp_is_expedited(). These delays appear to not be very welcome
>> by the suspend/resume code as evidenced by these occasional suspend
>> failures.
>>
>> This commit therefore checks if rcu_gp_is_expedited() and ignores the
>> lazy hint if so.
>>
>> Ignoring the lazy hint if rcu_gp_is_expedited() makes the 3000
>> suspend/resume cycles pass reliably on a 12th gen 12-core Intel CPU.
>
> Yow!!! ;-)
:-D
>> Fixes: 3cb278e73be5 ("rcu: Make call_rcu() lazy to save power")
>> Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
>> ---
>> Paul, could we take this for 6.2 -rc cycle? Thanks.
>>
>> 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 63545d79da51..93eb03f8ed99 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;
>
> Please put "lazy" in alpha order. Except that...
Ah sure.
>
>> /* 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_gp_is_expedited();
>
> Doesn't this completely disable laziness on Android?
Good point, I am not sure but it could be. Maybe it is safer that I add
a new suspend-indicator then, with corresponding
suspend entry/exit calls like we do for expedited.
That way anyone doing it this way will not disable
lazy fully.
Thoughts?
Thanks!
- Joel
>
> Thanx, Paul
>
>> /* 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-09 23:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-09 22:17 Joel Fernandes (Google)
2023-01-09 23:14 ` Paul E. McKenney
2023-01-09 23:20 ` Joel Fernandes [this message]
2023-01-09 23:55 ` 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=C461EF52-B060-4871-8C20-30824983E787@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=foo@bar.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 \
/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®