mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hang Zhengyang via B4 Relay <devnull+hang.zhengyang1010.gmail.com@kernel.org>
To: Tejun Heo <tj@kernel.org>, David Vernet <void@manifault.com>,
	 Andrea Righi <arighi@nvidia.com>,
	Changwoo Min <changwoo@igalia.com>,
	 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>
Cc: Joel Fernandes <joelagnelf@nvidia.com>,
	sched-ext@lists.linux.dev,  linux-kernel@vger.kernel.org,
	stable@vger.kernel.org,
	 Hang Zhengyang <hang.zhengyang1010@gmail.com>
Subject: [PATCH sched_ext/for-7.4-fixes 0/2] sched_ext: Fix two gaps in dl_server protection against RT starvation
Date: Mon, 23 Nov 2026 02:04:53 +0800	[thread overview]
Message-ID: <20261123-scx-dlsrv-v1-0-87c342d8246e@gmail.com> (raw)

These patches fix two cases where a dl_server should protect tasks from
an RT task but isn't running. The starved tasks then hold up the
scheduler disable. It doesn't finish until the RT task stops.

Patch 1: in full mode, the disable attaches fair_server only at the end.
Tasks move back to fair long before that.

Patch 2: a CPU's ext_server restarts only when the first sched_ext task
is enqueued there. If it stops while tasks are still queued, nothing
restarts it.

Both came out of one stress test (scx_simple, CPU hotplug, stress-ng,
SCHED_FIFO spinners). The patches don't depend on each other.

Tested on sched_ext/for-7.4-fixes (8e156b9218f9) in an 8 vCPU KVM guest
with PREEMPT, PREEMPT_RCU and NO_HZ_FULL:

                         no patches    patch 1        patch 2   both
  patch 1 repro          37/300 stuck  0/300          -         0/300
  same, KASAN+lockdep    3/100 stuck   0/100          -         0/100
  stress, KASAN+lockdep  hung, 4 min   hung, 2-5 min  1/3 hung  6/7 ok [*]
  stress, no debug       -             2/2 ok         -         3/3 ok
  selftests              -             38 ok, 2 skip  -         38 ok, 2 skip
  messaging [**]         1.849 s       -              -         1.821 s

  Each stress run is 15 minutes.
  [*]  The 7th run stopped at 2.5 min. A fork stalled for 75 s with the
       scheduler enabled, then went on. Not the disable hang. Cause not
       found.
  [**] perf bench sched messaging -g 8 -l 1000 under scx_simple, mean of
       15 runs

With patch 2 alone, the one stress hang was the problem patch 1 fixes.

Patch 2's cost: during a scheduler reload, ext_server restarted and
stopped 238 times in 41 ms on one CPU. I also ran an RT spinner with
sched_ext tasks on the same CPU, under scx_simple and scx_central.
There, patch 2 changed neither the restart count nor the time the RT
task lost.

I didn't test on bare metal, or with other schedulers outside that cost
test. I didn't write selftests, because both hangs depend on timing.

I used Claude Code to find the issues, write the patches and run the
tests. I reran the reproducer and reviewed the patches.

---
Hang Zhengyang (2):
      sched_ext: Attach fair_server before tasks fall back to fair on disable
      sched_ext: Start ext_server on every enqueue

 kernel/sched/ext/ext.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)
---
base-commit: 8e156b9218f9f1f8b866d8e253145afdb01cf289
change-id: 20261121-scx-dlsrv-7d44ef45820e

Best regards,
-- 
Hang Zhengyang <hang.zhengyang1010@gmail.com>



             reply	other threads:[~2026-11-22 18:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 18:04 Hang Zhengyang via B4 Relay [this message]
2026-11-22 18:04 ` [PATCH sched_ext/for-7.4-fixes 1/2] sched_ext: Attach fair_server before tasks fall back to fair on disable Hang Zhengyang via B4 Relay
2026-11-22 18:04 ` [PATCH sched_ext/for-7.4-fixes 2/2] sched_ext: Start ext_server on every enqueue Hang Zhengyang via B4 Relay

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=20261123-scx-dlsrv-v1-0-87c342d8246e@gmail.com \
    --to=devnull+hang.zhengyang1010.gmail.com@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=bsegall@google.com \
    --cc=changwoo@igalia.com \
    --cc=dietmar.eggemann@arm.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=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --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

all inboxes | Powered by JetHome®