From: Joel Fernandes <joel@joelfernandes.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kernel@vger.kernel.org,
Frederic Weisbecker <frederic@kernel.org>,
Lai Jiangshan <jiangshanlai@gmail.com>,
linux-doc@vger.kernel.org,
"Paul E. McKenney" <paulmck@kernel.org>,
rcu@vger.kernel.org
Subject: Re: [PATCH RFC] rcu: Add a minimum time for marking boot as completed
Date: Sat, 25 Feb 2023 03:59:32 +0000 [thread overview]
Message-ID: <Y/mHpOrr1C8NkMWm@google.com> (raw)
In-Reply-To: <ea03e810-95f0-abd8-2a83-f83174a99dbf@infradead.org>
On Fri, Feb 24, 2023 at 07:32:22PM -0800, Randy Dunlap wrote:
[..]
> > +
> > + Accept the default if unsure.
> > +
> > config RCU_EXP_KTHREAD
> > bool "Perform RCU expedited work in a real-time kthread"
> > depends on RCU_BOOST && RCU_EXPERT
> > diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
> > index 19bf6fa3ee6a..5b73341d9b89 100644
> > --- a/kernel/rcu/update.c
> > +++ b/kernel/rcu/update.c
> > @@ -62,6 +62,10 @@ module_param(rcu_normal_after_boot, int, 0444);
> > #endif
> > #endif /* #ifndef CONFIG_TINY_RCU */
> >
> > +/* Minimum time until RCU considers boot as completed. */
> > +static int boot_end_delay = CONFIG_RCU_BOOT_END_DELAY;
> > +module_param(boot_end_delay, int, 0444);
> > +
> > #ifdef CONFIG_DEBUG_LOCK_ALLOC
> > /**
> > * rcu_read_lock_held_common() - might we be in RCU-sched read-side critical section?
> > @@ -225,12 +229,29 @@ void rcu_unexpedite_gp(void)
> > EXPORT_SYMBOL_GPL(rcu_unexpedite_gp);
> >
> > static bool rcu_boot_ended __read_mostly;
> > -
> > /*
> > - * Inform RCU of the end of the in-kernel boot sequence.
> > + * Inform RCU of the end of the in-kernel boot sequence. The boot sequence will
> > + * not be marked ended until at least boot_end_delay milliseconds have passed.
> > */
> > +void rcu_end_inkernel_boot(void);
> > +static void boot_rcu_work_fn(struct work_struct *work)
> > +{
> > + rcu_end_inkernel_boot();
> > +}
> > +static DECLARE_DELAYED_WORK(boot_rcu_work, boot_rcu_work_fn);
> > +
> > void rcu_end_inkernel_boot(void)
> > {
> > + if (boot_end_delay) {
> > + u64 boot_ms = ktime_get_boot_fast_ns() / 1000000UL;
>
> Is that division OK on 32-bit? Might have to use a helper macro. (I dunno.)
I believe the below should work on 32-bit, but I will test it more. It does
on 64-bit.
Thanks!
---8<-----------------------
diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
index cbdad7b46841..2f539c18b310 100644
--- a/kernel/rcu/update.c
+++ b/kernel/rcu/update.c
@@ -243,7 +243,7 @@ static DECLARE_DELAYED_WORK(boot_rcu_work, boot_rcu_work_fn);
void rcu_end_inkernel_boot(void)
{
if (boot_end_delay) {
- u64 boot_ms = ktime_get_boot_fast_ns() / 1000000UL;
+ u64 boot_ms = div_u64(ktime_get_boot_fast_ns(), 1000000UL);
if (boot_ms < boot_end_delay) {
schedule_delayed_work(&boot_rcu_work,
--
2.39.2.637.g21b0678d19-goog
next prev parent reply other threads:[~2023-02-25 3:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-25 3:27 [PATCH RFC] rcu: Add a minimum time for marking boot as completed Joel Fernandes (Google)
2023-02-25 3:32 ` Randy Dunlap
2023-02-25 3:52 ` Joel Fernandes
2023-02-25 3:59 ` Joel Fernandes [this message]
2023-02-27 0:03 ` Randy Dunlap
2023-02-27 13:24 ` Joel Fernandes
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=Y/mHpOrr1C8NkMWm@google.com \
--to=joel@joelfernandes.org \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rdunlap@infradead.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;
as well as URLs for NNTP newsgroup(s).