The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: sched-ext@lists.linux.dev
Cc: David Vernet <void@manifault.com>,
	Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	David Dai <david.dai@linux.dev>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Joel Fernandes <joelagnelf@nvidia.com>,
	Hang Zhengyang <hang.zhengyang1010@gmail.com>,
	linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: [PATCH 2/2] sched_ext: Start ext_server from the remote tick on nohz_full CPUs
Date: Wed, 25 Nov 2026 00:34:20 -1000	[thread overview]
Message-ID: <20261125103420.2785659-3-tj@kernel.org> (raw)
In-Reply-To: <20261125103420.2785659-1-tj@kernel.org>

On a nohz_full CPU, the tick can stop while SCHED_FIFO tasks or a single
SCHED_RR task run, and ext_server is no longer started from it.
sched_tick_remote() does the tick's work once a second for a CPU whose tick
is stopped. Start ext_server from there too.

A nohz_full CPU running an RT task is now made to dispatch about once every
two seconds while any task is runnable on SCX. Setting the CPU's ext_server
runtime to 0 turns that off.

Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/sched/core.c    |  1 +
 kernel/sched/ext/ext.c | 12 ++++++++++++
 kernel/sched/ext/ext.h |  2 ++
 3 files changed, 15 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1ac779bb34f7..7a8ae8e8d7c6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5925,6 +5925,7 @@ static void sched_tick_remote(struct work_struct *work)
 				WARN_ON_ONCE(delta > (u64)NSEC_PER_SEC * 30);
 			}
 			curr->sched_class->task_tick(rq, curr, 0);
+			scx_tick_remote(rq);
 
 			calc_load_nohz_remote(rq);
 		}
diff --git a/kernel/sched/ext/ext.c b/kernel/sched/ext/ext.c
index e081f853a155..c96d94a7767a 100644
--- a/kernel/sched/ext/ext.c
+++ b/kernel/sched/ext/ext.c
@@ -4511,6 +4511,18 @@ void scx_tick(struct rq *rq)
 	ext_server_tick(rq);
 }
 
+#ifdef CONFIG_NO_HZ_FULL
+/*
+ * Called once a second while @rq's tick is stopped. An RT task can keep the
+ * tick stopped with tasks runnable on SCX, see ext_server_tick().
+ */
+void scx_tick_remote(struct rq *rq)
+{
+	if (scx_enabled())
+		ext_server_tick(rq);
+}
+#endif
+
 static void task_tick_scx(struct rq *rq, struct task_struct *donor, int queued)
 {
 	struct scx_sched *sch = scx_task_sched(donor);
diff --git a/kernel/sched/ext/ext.h b/kernel/sched/ext/ext.h
index 366cc1d7089b..6ce6d50ac393 100644
--- a/kernel/sched/ext/ext.h
+++ b/kernel/sched/ext/ext.h
@@ -9,6 +9,7 @@
 #ifdef CONFIG_SCHED_CLASS_EXT
 
 void scx_tick(struct rq *rq);
+void scx_tick_remote(struct rq *rq);
 void init_scx_entity(struct sched_ext_entity *scx);
 void scx_pre_fork(struct task_struct *p);
 int scx_fork(struct task_struct *p, struct kernel_clone_args *kargs);
@@ -63,6 +64,7 @@ bool scx_prio_less(const struct task_struct *a, const struct task_struct *b,
 #else	/* CONFIG_SCHED_CLASS_EXT */
 
 static inline void scx_tick(struct rq *rq) {}
+static inline void scx_tick_remote(struct rq *rq) {}
 static inline void scx_pre_fork(struct task_struct *p) {}
 static inline int scx_fork(struct task_struct *p, struct kernel_clone_args *kargs) { return 0; }
 static inline void scx_post_fork(struct task_struct *p) {}
-- 
2.56.1


      parent reply	other threads:[~2026-11-25 10:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 10:34 [PATCHSET sched_ext/for-7.5] sched_ext: Start ext_server from the tick Tejun Heo
2026-11-25 10:34 ` [PATCH 1/2] sched_ext: Start ext_server from the tick while a higher class holds the CPU Tejun Heo
2026-11-25 10:34 ` Tejun Heo [this message]

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=20261125103420.2785659-3-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=changwoo@igalia.com \
    --cc=david.dai@linux.dev \
    --cc=dietmar.eggemann@arm.com \
    --cc=emil@etsalapatis.com \
    --cc=hang.zhengyang1010@gmail.com \
    --cc=joelagnelf@nvidia.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=vincent.guittot@linaro.org \
    --cc=void@manifault.com \
    --cc=vschneid@redhat.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