Linux RCU subsystem development
 help / color / mirror / Atom feed
* [RFC] jiffies_till_first_fqs off by 1
@ 2025-12-23 17:38 Joel Fernandes
  2025-12-23 23:53 ` Paul E. McKenney
  0 siblings, 1 reply; 10+ messages in thread
From: Joel Fernandes @ 2025-12-23 17:38 UTC (permalink / raw)
  To: rcu
  Cc: Steven Rostedt, linux-kernel, Davidlohr Bueso, Josh Triplett,
	Frederic Weisbecker, Neeraj Upadhyay, Boqun Feng,
	Uladzislau Rezki, Mathieu Desnoyers, Lai Jiangshan, Zqiang, rcu

Hello,

During studying some synchronize_rcu() latencies, I found that the
jiffies_till_first_fqs value passed to the timer tick subsystem does is always
off by one. This is natural due to calc_index() rounding up.

For example, jiffies_till_first_fqs=3 means the "Jiffies till first FQS" delay
is actually 4ms. And same for the next FQS. In fact, in testing it shows it can
never ever be 3ms for HZ=1000. And in rare cases, it will go to 5ms probably due
to interrupts.

Considering this, I think it is better to reduce the jiffies_till_first_fqs by 1
before passing it to the wait APIs.

But before I wanted to send a patch, I wanted to get everyone's thoughts.
Considering this the RFC.

The other place I found this was when call_rcu_hurry() is called, but the GP
thread takes a tick to wake up, but this isn't related to the timer per-se, it
is just that we don't want to wake the GP thread too often. So we just wait for
the next tick to notice callbacks before doing a wakeup.

Heh, and this means synchronize_rcu() latencies will multiply when HZ < 1000. I
wonder if this is also what caused Uladzislau to investigate it for mobile devices.

 - Joel


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-01-02 19:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23 17:38 [RFC] jiffies_till_first_fqs off by 1 Joel Fernandes
2025-12-23 23:53 ` Paul E. McKenney
2025-12-24  2:06   ` Joel Fernandes
2025-12-25 18:54     ` Paul E. McKenney
2025-12-26  2:15       ` Joel Fernandes
2026-01-01 22:24         ` Paul E. McKenney
2026-01-02  2:59           ` Joel Fernandes
2026-01-02  3:41             ` Paul E. McKenney
2026-01-02 17:58               ` Joel Fernandes
2026-01-02 19:50                 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox