From: "Paul E. McKenney" <paulmck@kernel.org>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
rostedt@goodmis.org, "Paul E. McKenney" <paulmck@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Neil Spring <ntspring@fb.com>
Subject: [PATCH rcu 4/9] rcu-tasks: Make Tasks RCU account for userspace execution
Date: Mon, 18 Apr 2022 17:00:09 -0700 [thread overview]
Message-ID: <20220419000014.3948512-4-paulmck@kernel.org> (raw)
In-Reply-To: <20220419000007.GA3945818@paulmck-ThinkPad-P17-Gen-1>
The main Tasks RCU quiescent state is voluntary context switch. However,
userspace execution is also a valid quiescent state, and is a valuable one
for userspace applications that spin repeatedly executing light-weight
non-sleeping system calls. Currently, such an application can delay a
Tasks RCU grace period for many tens of seconds.
This commit therefore enlists the aid of the scheduler-clock interrupt to
provide a Tasks RCU quiescent state when it interrupted a task executing
in userspace.
[ paulmck: Apply feedback from kernel test robot. ]
Cc: Martin KaFai Lau <kafai@fb.com>
Cc: Neil Spring <ntspring@fb.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
include/linux/rcupdate.h | 1 +
kernel/rcu/tree.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index e7c39c200e2b..1a32036c918c 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -196,6 +196,7 @@ void synchronize_rcu_tasks_rude(void);
void exit_tasks_rcu_start(void);
void exit_tasks_rcu_finish(void);
#else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
+#define rcu_tasks_classic_qs(t, preempt) do { } while (0)
#define rcu_tasks_qs(t, preempt) do { } while (0)
#define rcu_note_voluntary_context_switch(t) do { } while (0)
#define call_rcu_tasks call_rcu
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index a4b8189455d5..8dbfb63f0391 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2624,6 +2624,8 @@ void rcu_sched_clock_irq(int user)
rcu_flavor_sched_clock_irq(user);
if (rcu_pending(user))
invoke_rcu_core();
+ if (user)
+ rcu_tasks_classic_qs(current, false);
lockdep_assert_irqs_disabled();
trace_rcu_utilization(TPS("End scheduler-tick"));
--
2.31.1.189.g2e36527f23
next prev parent reply other threads:[~2022-04-19 0:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 0:00 [PATCH rcu 0/9] Tasks-RCU updates for v5.19 Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 1/9] rcu-tasks: Fix race in schedule and flush work Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 2/9] rcu-tasks: Print pre-stall-warning informational messages Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 3/9] rcu-tasks: Use rcuwait for the rcu_tasks_kthread() Paul E. McKenney
2022-04-19 0:00 ` Paul E. McKenney [this message]
2022-04-19 0:00 ` [PATCH rcu 5/9] rcu-tasks: Use schedule_hrtimeout_range() to wait for grace periods Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 6/9] rcu-tasks: Restore use of timers for non-RT kernels Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 7/9] rcu-tasks: Make show_rcu_tasks_generic_gp_kthread() check all CPUs Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 8/9] rcu-tasks: Handle sparse cpu_possible_mask Paul E. McKenney
2022-04-19 0:00 ` [PATCH rcu 9/9] rcu-tasks: Handle sparse cpu_possible_mask in rcu_tasks_invoke_cbs() 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=20220419000014.3948512-4-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=kafai@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntspring@fb.com \
--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®