mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Qais Yousef <qyousef@layalina.io>, Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	John Stultz <jstultz@google.com>,
	linux-kernel@vger.kernel.org, Wei Wang <wvw@google.com>
Subject: Re: [PATCH v4 1/2] sched/uclamp: Fix race condition leading to imbalanced uclamp_rq
Date: Fri, 30 Oct 2026 13:21:30 +0000	[thread overview]
Message-ID: <7b9c9ab0-7b3d-414b-b1b1-5416be256cc7@arm.com> (raw)
In-Reply-To: <20261030124119.xulxkpo7aas3wlwa@airbuntu>

On 10/30/26 12:41, Qais Yousef wrote:
> On 10/30/26 13:15, Peter Zijlstra wrote:
>> On Fri, Oct 30, 2026 at 11:28:25AM +0000, Qais Yousef wrote:
>>
>>> Peter/Vincent, what do you think? It seems we have a schrodenger task that is
>>> both enqueued and dequeued simultaneously in these throttling paths. Shouldn't
>>> this be fixed? If yes, any thoughts on the right approach? Should we throttle
>>> if there are no other tasks on the rq too? I didn't realize the semantics are
>>> that strong for enforcing the quota.
>>
>> Urgh, nothing is ever straight forward is it ...
> 
> Exactly my thoughts..
> 
>>
>> Bah, so this is because the core does uclamp (for classes that have it
>> on) but then the class does the throttle without going through the core
>> {en,de}queue.
>>
>> Does it make sense to have throttle_Cfs_rq_work() and tg_unthrottle_up()
>> do uclamp_rq_{dec,inc}() respectively, along with the
>> {de,en}queue_task_fair() they're already doing?
> 
> Yes it does, just wanted to make sure we agree the bug is there rather than in
> the current patchset approach.
> 
> I remember seeing a patch to remove the uclamp_enabled bit and defer to
> enqueue/dequeue_task_$class to handle this instead. Maybe I can revive it if it
> makes more sense to go that way.
> 
> Let me find the path of least resistance and add it to the stack. Not sure we
> want to tag as Fixes for LTS to pick up this independent fix. Note we have rt
> group throttling path flagged up - which I also thought was false positive but
> not sure anymore - but it seems to do partial dequeue and must be fixed in that
> regard anyway even if it doesn't force idle.

I can reproduce the idle path without uclamp_rq_dec through sched_rt_rq_dequeue(),
too, so IMO that needs fixing up as well.

  reply	other threads:[~2026-10-30 13:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 13:13 [PATCH v4 0/2] Fix uclamp race against non atomic static key enable Qais Yousef
2026-10-29 13:13 ` [PATCH v4 1/2] sched/uclamp: Fix race condition leading to imbalanced uclamp_rq Qais Yousef
2026-10-29 15:58   ` Christian Loehle
2026-10-29 23:43     ` Qais Yousef
2026-10-30 10:50       ` Christian Loehle
2026-10-30 11:28         ` Qais Yousef
2026-10-30 12:15           ` Peter Zijlstra
2026-10-30 12:41             ` Qais Yousef
2026-10-30 13:21               ` Christian Loehle [this message]
2026-10-30 14:13                 ` Peter Zijlstra
2026-10-29 13:13 ` [PATCH v4 2/2] sched/uclamp: Use wrappers instead of open coding UCLAMP_FLAG_IDLE Qais Yousef

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=7b9c9ab0-7b3d-414b-b1b1-5416be256cc7@arm.com \
    --to=christian.loehle@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=jstultz@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.org \
    --cc=wvw@google.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®