From: Frederic Weisbecker <frederic@kernel.org>
To: "Paul E . McKenney" <paulmck@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Uladzislau Rezki <urezki@gmail.com>,
Boqun Feng <boqun.feng@gmail.com>, Ingo Molnar <mingo@kernel.org>,
Neeraj Upadhyay <neeraju@codeaurora.org>,
Joel Fernandes <joel@joelfernandes.org>
Subject: [PATCH 1/2] rcu: Explain why rcu_all_qs() is a stub in preemptible TREE RCU
Date: Tue, 6 Jul 2021 01:43:43 +0200 [thread overview]
Message-ID: <20210705234344.104239-1-frederic@kernel.org> (raw)
cond_resched() reports an RCU quiescent state only in non-preemptible
TREE RCU implementation. Provide an explanation for the different
behaviour in CONFIG_PREEMPT_RCU=y.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Neeraj Upadhyay <neeraju@codeaurora.org>
Cc: Joel Fernandes <joel@joelfernandes.org>
Cc: Uladzislau Rezki <urezki@gmail.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index cf16f8fda9a6..db374cb38eb2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7780,6 +7780,19 @@ int __sched __cond_resched(void)
preempt_schedule_common();
return 1;
}
+ /*
+ * A process spending a long time in the kernel space might
+ * have too few opportunities to report quiescent states
+ * when CONFIG_PREEMPT_RCU=n because then the tick can't know
+ * if it's interrupting an RCU read side critical section. In the
+ * absence of voluntary sleeps, the last resort resides in tracking
+ * calls to cond_resched() which always imply quiescent states.
+ *
+ * On the other hand, preemptible RCU has a real RCU read side
+ * tracking that allows the tick for reporting interrupted quiescent
+ * states or, in the worst case, deferred quiescent states after
+ * rcu_read_unlock().
+ */
#ifndef CONFIG_PREEMPT_RCU
rcu_all_qs();
#endif
--
2.25.1
next reply other threads:[~2021-07-05 23:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 23:43 Frederic Weisbecker [this message]
2021-07-05 23:43 ` [PATCH 2/2] rcu: Remove needless preemption disablement in rcu_all_qs() Frederic Weisbecker
2021-07-06 7:51 ` Peter Zijlstra
2021-07-06 12:30 ` Frederic Weisbecker
2021-07-06 13:28 ` Boqun Feng
2021-07-06 16:24 ` Paul E. McKenney
2021-07-06 16:46 ` [PATCH 1/2] rcu: Explain why rcu_all_qs() is a stub in preemptible TREE RCU 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=20210705234344.104239-1-frederic@kernel.org \
--to=frederic@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=neeraju@codeaurora.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.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;
as well as URLs for NNTP newsgroup(s).