[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aKX9XPDt0yOzPQWv@slm.duckdns.org>
Date: Wed, 20 Aug 2025 06:52:44 -1000
From: 'Tejun Heo' <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: liuwenfang <liuwenfang@...or.com>, 'David Vernet' <void@...ifault.com>,
'Andrea Righi' <arighi@...dia.com>,
'Changwoo Min' <changwoo@...lia.com>,
'Ingo Molnar' <mingo@...hat.com>,
'Juri Lelli' <juri.lelli@...hat.com>,
'Vincent Guittot' <vincent.guittot@...aro.org>,
'Dietmar Eggemann' <dietmar.eggemann@....com>,
'Steven Rostedt' <rostedt@...dmis.org>,
'Ben Segall' <bsegall@...gle.com>, 'Mel Gorman' <mgorman@...e.de>,
'Valentin Schneider' <vschneid@...hat.com>,
"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
Joel Fernandes <joelagnelf@...dia.com>
Subject: Re: [PATCH v4 2/3] sched_ext: Fix cpu_released while RT task and SCX
task are scheduled concurrently
Hello,
On Wed, Aug 20, 2025 at 11:18:10AM +0200, Peter Zijlstra wrote:
> > This guarantee changes if we add @rf to pick_task() and let it unlock and
> > relock. A higher priority task may get queued while the rq lock is
> > released and then the lower priority pick_task() may still return a task
> > of its own.
>
> No, this would be broken. This guarantee must not change.
>
> What you can do however is something like:
>
> again:
> p = pick_local_task();
> if (!p) {
> unlock(rq, rf);
> // get yourself a local task
> lock(rq, rf);
> if (higher-class-task-available(rq)) {
> // roll back whatever state
> return RETRY_TASK;
> }
> goto again;
> }
>
> return p;
Isn't that kinda nasty as we'd have to do that in every pick_task(). What'd
be equivalent but in a central location would be making sure that
wakeup_preempt() asserts a resched event if it hits a race window like that.
I haven't thought too much about how that should be done exactly but the
races should be pretty rare, so it'd be surprising if the behavior
difference is noticeable.
Thanks.
--
tejun
Powered by blists - more mailing lists