From: Hui Su <sh_def@163.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Mikhail Zaslonko <zaslonko@linux.ibm.com>
Cc: 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>,
Luca Abeni <luca.abeni@santannapisa.it>,
Daniel Bristot de Oliveira <bristot@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] sched/deadline: Fix zero-CPU DL bandwidth handling
Date: Sun, 20 Sep 2026 00:31:48 +0900 [thread overview]
Message-ID: <20260919153150.2618403-1-sh_def@163.com> (raw)
During CPU hot-unplug, a CPU is removed from cpu_active_mask before it
becomes offline. If it is the last active CPU in a root domain,
dl_bw_cpus() can therefore return zero while paths associated with the CPU
are still reachable.
v1 addressed this in the DL server parameter-update path. Mikhail Zaslonko
reported the same divide-by-zero on s390x through sched_setscheduler(),
showing that the problem is more general, and pointed out several other
callers of __dl_sub() and __dl_add().
This version moves the zero-CPU handling into those common helpers. The
debugfs cpu_active() check is kept as a separate follow-up because it
completes the offline-CPU check added by 4043f5498416, while the generic
helper issue dates back much further. Keeping them separate also gives the
two fixes the appropriate stable backport scopes.
Patch 1 fixes the generic divide-by-zero while retaining the existing
total_bw update when no active CPU remains.
Patch 2 rejects per-CPU DL server debugfs writes once the CPU becomes
inactive instead of waiting until it is fully offline.
Validation on x86_64 included:
- cpus=0/1/2/4 DL bandwidth accounting
- targeted task_non_contending() and inactive_task_timer() zero-CPU paths
- 100 root-domain rebuild/offline-online cycles with accounting checks
- 200 cross-root-domain SCHED_DEADLINE cpuset moves
- SCHED_FLAG_RECLAIM policy transitions
- concurrent SCHED_DEADLINE/SCHED_OTHER transitions and CPU hotplug
- 100 CPU hotplug/debugfs update cycles
- A/B validation of the inactive-but-online debugfs window: the write was
accepted and changed runtime with patch 1 only, but was rejected and left
runtime unchanged with both patches
The final series was also built and boot-smoke-tested from its exact HEAD.
Changes since v1:
- Handle cpus == 0 in __dl_sub() and __dl_add(), as suggested by Mikhail.
- Split the generic bandwidth fix from the DL server debugfs check.
- Add the s390x sched_setscheduler() report.
- Extend validation to the other DL bandwidth paths and accounting cases.
Hui Su (2):
sched/deadline: Fix divide-by-zero in DL bandwidth accounting
sched/deadline: Reject debugfs dl_server writes for inactive CPUs
kernel/sched/deadline.c | 6 ++++--
kernel/sched/debug.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
base-commit: f259f446f5198d98e13756d2cd531812a0ad3064
--
2.55.0
next reply other threads:[~2026-09-19 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 15:31 Hui Su [this message]
2026-09-19 15:31 ` [PATCH v2 1/2] sched/deadline: Fix divide-by-zero in DL bandwidth accounting Hui Su
2026-09-22 12:29 ` Juri Lelli
2026-09-19 15:31 ` [PATCH v2 2/2] sched/deadline: Reject debugfs dl_server writes for inactive CPUs Hui Su
2026-09-22 12:30 ` Juri Lelli
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=20260919153150.2618403-1-sh_def@163.com \
--to=sh_def@163.com \
--cc=bristot@kernel.org \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@santannapisa.it \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zaslonko@linux.ibm.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®