linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alison Chaiken <achaiken@aurora.tech>
To: tglx@linutronix.de
Cc: peterz@infradead.org, paulmck@kernel.org,
	valentin.schneider@arm.com, frederic@kernel.org,
	linux-kernel@vger.kernel.org, glenn@aurora.tech,
	alison@she-devel.com, Alison Chaiken <achaiken@aurora.tech>
Subject: [PATCH 3/4] RCU: elevate priority of offloaded callback threads
Date: Tue, 11 Jan 2022 15:32:52 -0800	[thread overview]
Message-ID: <20220111233253.21692-4-achaiken@aurora.tech> (raw)
In-Reply-To: <20220111233253.21692-1-achaiken@aurora.tech>

When CONFIG_PREEMPT_RT=y, the rcutree.kthread_prio command-line
parameter signals initialization code to boost the priority of rcuc
callbacks to the designated value.  With the additional
CONFIG_RCU_NOCB_CPU=y configuration and an additional rcu_nocbs
command-line parameter, the callbacks on the listed cores are
offloaded to new rcuop threads that are not pinned to the cores whose
post-grace-period work is performed.  While the rcuop threads perform
the same function as the rcuc threads they offload, the kthread_prio
parameter only boosts the priority of the rcuc threads.  Fix this
inconsistency by elevating rcuop threads to the same priority as rcuc
ones.

Signed-off-by: Alison Chaiken <achaiken@aurora.tech>
---
 kernel/rcu/tree.c      | 2 +-
 kernel/rcu/tree_nocb.h | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 15cabb288a1c..ba9eaa9a72b0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -153,7 +153,7 @@ static void sync_sched_exp_online_cleanup(int cpu);
 static void check_cb_ovld_locked(struct rcu_data *rdp, struct rcu_node *rnp);
 static bool rcu_rdp_is_offloaded(struct rcu_data *rdp);
 
-/* rcuc/rcub kthread realtime priority */
+/* rcuc/rcub/rcuop kthread realtime priority */
 static int kthread_prio = IS_ENABLED(CONFIG_RCU_BOOST) ? 1 : 0;
 module_param(kthread_prio, int, 0444);
 
diff --git a/kernel/rcu/tree_nocb.h b/kernel/rcu/tree_nocb.h
index 08b5c0042979..3343e42685dc 100644
--- a/kernel/rcu/tree_nocb.h
+++ b/kernel/rcu/tree_nocb.h
@@ -1210,6 +1210,9 @@ static void rcu_spawn_one_nocb_kthread(int cpu)
 			"rcuo%c/%d", rcu_state.abbr, cpu);
 	if (WARN_ONCE(IS_ERR(t), "%s: Could not start rcuo CB kthread, OOM is now expected behavior\n", __func__))
 		return;
+
+	if (kthread_prio)
+		sched_setscheduler_nocheck(t, SCHED_FIFO, &sp);
 	WRITE_ONCE(rdp->nocb_cb_kthread, t);
 	WRITE_ONCE(rdp->nocb_gp_kthread, rdp_gp->nocb_gp_kthread);
 }
-- 
2.32.0


  parent reply	other threads:[~2022-01-13  2:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-11 23:32 [PATCH 0/5] handle kthread_prio kernel cmdline parameter consistently Alison Chaiken
2022-01-11 23:32 ` [PATCH 1/4] RCU: move kthread_prio bounds-check to a separate function Alison Chaiken
2022-01-11 23:32 ` [PATCH 2/4] RCU: make priority of grace-period thread consistent Alison Chaiken
2022-01-11 23:32 ` Alison Chaiken [this message]
2022-01-11 23:32 ` [PATCH 4/4] RCU: update documentation regarding kthread_prio cmdline parameter Alison Chaiken
2022-01-12  1:03 ` [PATCH 0/5] handle kthread_prio kernel cmdline parameter consistently 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=20220111233253.21692-4-achaiken@aurora.tech \
    --to=achaiken@aurora.tech \
    --cc=alison@she-devel.com \
    --cc=frederic@kernel.org \
    --cc=glenn@aurora.tech \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=valentin.schneider@arm.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).