mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Juri Lelli <juri.lelli@redhat.com>
To: Tejun Heo <tj@kernel.org>
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: Mon, 2 Nov 2026 11:08:24 +0100	[thread overview]
Message-ID: <auhhGAjRtuSb5JP7@jlelli-thinkpadt14gen4.remote.csb> (raw)
In-Reply-To: <1a24bcdde0bb6e4a8c839351002e841d@kernel.org>

On 30/10/26 14:47, Tejun Heo wrote:
> 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.

Thanks for testing and reporting the additional issues!

> 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.

sched_setattr(OTHER, KEEP_PARAMS) on a DEADLINE task doesn't make much
sense to me :).. I'm inclined to think we want to fail early in this
case.

> 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.

This one looks like a pre-existing issue which my total_bw fix makes
worse (w/p it we leak but don't crash).

Let me see what I can do about both.

Thanks,
Juri


  reply	other threads:[~2026-11-02 10:08 UTC|newest]

Thread overview: 6+ 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
2026-11-02 10:08     ` Juri Lelli [this message]
2026-11-02 11:15       ` Juri Lelli
2026-11-02 16:34         ` Tejun Heo

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=auhhGAjRtuSb5JP7@jlelli-thinkpadt14gen4.remote.csb \
    --to=juri.lelli@redhat.com \
    --cc=arighi@nvidia.com \
    --cc=dietmar.eggemann@arm.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=tj@kernel.org \
    --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®