mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Juri Lelli <juri.lelli@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Valentin Schneider <vschneid@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Luca Abeni <luca.abeni@santannapisa.it>,
	Andrea Righi <arighi@nvidia.com>,
	sched-ext@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: sched/deadline: total_bw leak when a task leaves SCHED_DEADLINE while not queued
Date: Fri, 30 Oct 2026 14:47:23 -1000	[thread overview]
Message-ID: <1a24bcdde0bb6e4a8c839351002e841d@kernel.org> (raw)
In-Reply-To: <auRh42kZI1xLIWNr@jlelli-thinkpadt14gen4.remote.csb>

Hello, Juri.

On Fri, Oct 30, 2026 at 10:22:43AM +0100, Juri Lelli wrote:
> Does the below help?

Yes, it fixes the leak. On abf8c33470f7 with the patch, the reproducer leaks
0 in all three cases, and 60s of random policy churn ends with total_bw back
at its starting value. Two problems though.

sched_setattr(SCHED_OTHER) with SCHED_FLAG_KEEP_PARAMS on a sleeping
DEADLINE task leaves it DEADLINE, but each call releases its bandwidth, and
its exit releases it again. total_bw relative to before the task became
DEADLINE, with a 2ms/10ms task (0.2 CPU = 209715):

  after the DEADLINE set        +209715
  after the 1st KEEP_PARAMS call      0
  after the 2nd                 -209715
  after the 3rd                 -419430
  after the task exits          -629145

After that, sched_setattr(SCHED_DEADLINE) for a new 2ms/10ms task fails with
-EBUSY while a 3ms/10ms one is admitted, and offlining a CPU fails with
-EBUSY.

Switching a sleeping DEADLINE task to SCHED_OTHER after its CPU was offlined
crashes in the __dl_sub() the patch adds, dividing by
dl_bw_cpus(task_cpu(p)), which is 0 for that root domain:

  Oops: divide error: 0000 [#1] SMP NOPTI
  RIP: 0010:switched_from_dl+0x13a/0x3e0

Unpatched mainline only leaks in this case.

Thanks.

--
tejun

      reply	other threads:[~2026-10-31  0:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 21:55 Tejun Heo
2026-10-30  9:22 ` Juri Lelli
2026-10-31  0:47   ` 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=1a24bcdde0bb6e4a8c839351002e841d@kernel.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.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=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=vincent.guittot@linaro.org \
    --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®