mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rcu: Add exp QS check in rcu_exp_handler() for no-preemptible expedited RCU
@ 2022-06-22 10:35 Zqiang
  2022-06-22 12:26 ` Neeraj Upadhyay
  2022-06-22 17:25 ` Boqun Feng
  0 siblings, 2 replies; 12+ messages in thread
From: Zqiang @ 2022-06-22 10:35 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: rcu, linux-kernel

In CONFIG_PREEMPT=n and CONFIG_PREEMPT_COUNT=y kernel, after a exp
grace period begins, if detected current CPU enters idle in
rcu_exp_handler() IPI handler, will immediately report the exp QS of the
current cpu, at this time, maybe not being in an RCU read-side critical
section, but need wait until rcu-softirq or sched-clock irq or sched-switch
occurs on current CPU to check and report exp QS.

This commit add a exp QS check in rcu_exp_handler(), when not being
in an RCU read-side critical section, report exp QS earlier.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree_exp.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h
index be667583a554..34f08267410f 100644
--- a/kernel/rcu/tree_exp.h
+++ b/kernel/rcu/tree_exp.h
@@ -828,11 +828,14 @@ static void rcu_exp_handler(void *unused)
 {
 	struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
 	struct rcu_node *rnp = rdp->mynode;
+	bool preempt_bh_disabled =
+				!!(preempt_count() & (PREEMPT_MASK | SOFTIRQ_MASK));
 
 	if (!(READ_ONCE(rnp->expmask) & rdp->grpmask) ||
 	    __this_cpu_read(rcu_data.cpu_no_qs.b.exp))
 		return;
-	if (rcu_is_cpu_rrupt_from_idle()) {
+	if (rcu_is_cpu_rrupt_from_idle() ||
+			(IS_ENABLED(CONFIG_PREEMPT_COUNT) && !preempt_bh_disabled)) {
 		rcu_report_exp_rdp(this_cpu_ptr(&rcu_data));
 		return;
 	}
-- 
2.25.1


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

end of thread, other threads:[~2022-07-06  2:06 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 10:35 [PATCH] rcu: Add exp QS check in rcu_exp_handler() for no-preemptible expedited RCU Zqiang
2022-06-22 12:26 ` Neeraj Upadhyay
2022-06-22 17:25 ` Boqun Feng
2022-06-22 23:34   ` Zhang, Qiang1
2022-06-22 23:36     ` Zhang, Qiang1
2022-06-23  0:34     ` Paul E. McKenney
2022-06-23  2:15       ` Boqun Feng
2022-06-23  3:23         ` Zhang, Qiang1
2022-06-27 21:41           ` Paul E. McKenney
2022-06-28  4:32             ` Zhang, Qiang1
2022-07-05 19:14               ` Paul E. McKenney
2022-07-06  2:06                 ` Zhang, Qiang1

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®