mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Andrea Righi <arighi@nvidia.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	sched-ext@lists.linux.dev, David Vernet <void@manifault.com>,
	Changwoo Min <changwoo@igalia.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	Zicheng Qu <quzicheng@huawei.com>
Subject: Re: [RANT][PATCH] sched_ext: Fix stale fair load weight after renice under SCX
Date: Fri, 4 Dec 2026 05:44:23 -1000	[thread overview]
Message-ID: <axLf17tZOpX-0c48@slm.duckdns.org> (raw)
In-Reply-To: <axLe54vTUeRzDJdk@gpd4>

On Fri, Dec 04, 2026 at 04:40:23PM +0100, Andrea Righi wrote:
> Hi Steven,
> 
> On Fri, Dec 04, 2026 at 09:35:07AM -0500, Steven Rostedt wrote:
> > From: Steven Rostedt (LLM) <rostedt@goodmis.org>
> > 
> > While working on my scheduler governors using Claude, it discovered a bug
> > with the sched_ext reweight_task_scx() function. It wrote up the change
> > log and created a patch. The change log is below which is mostly from
> > Claude, but I did tweak it a little.
> > 
> > set_load_weight() hands a changed weight to the class's ->reweight_task
> > and only writes p->se.load itself when the class has no such hook:
> > 
> > 	if (update_load && p->sched_class->reweight_task)
> > 		p->sched_class->reweight_task(task_rq(p), p, &lw);
> > 	else
> > 		p->se.load = lw;
> > 
> > reweight_task_fair() updates se.load as part of reweighting, but
> > reweight_task_scx() only updates p->scx.weight. So a task whose nice
> > value changes while it is in the ext class keeps the fair load weight it
> > had before, and nothing refreshes it when the task goes back to fair:
> > neither switched_from_scx() nor scx_disable_task() does, and fair never
> > recomputes a task's weight when it switches in. Forks copy the stale
> > se.load too.
> 
> We already discussed this with Zicheng and Peter [1]. The approach we
> settled on was to rebuild the load weight in switching_to_fair(), so
> fair prepares its own state before enqueue, rather than having sched_ext
> maintain fair's inactive state.

Oh, I missed that. Lemme back out the patch.

Thanks.

-- 
tejun

  reply	other threads:[~2026-12-04 15:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 14:35 Steven Rostedt
2026-12-04 15:19 ` Tejun Heo
2026-12-04 15:40 ` Andrea Righi
2026-12-04 15:44   ` Tejun Heo [this message]
2026-12-04 15:59   ` Steven Rostedt
2026-12-04 16:33     ` Andrea Righi
2026-12-04 16:53       ` Steven Rostedt
2026-12-04 17:04         ` Andrea Righi
2026-12-04 17:16           ` Steven Rostedt
2026-12-04 17:27             ` Tejun Heo
2026-12-04 17:38               ` Sasha Levin
2026-12-04 17:29             ` Andrea Righi
2026-12-04 17:59               ` Steven Rostedt
2026-12-04 17:36           ` Sasha Levin
2026-12-04 16:19   ` Peter Zijlstra
2026-12-04 18:06 ` Linus Torvalds
2026-12-04 18:47   ` Steven Rostedt
2026-12-04 18:57     ` Linus Torvalds
2026-12-04 19:29       ` Steven Rostedt
2026-12-05 13:29         ` Steven Rostedt
2026-12-06  7:25 ` Laurent Pinchart

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=axLf17tZOpX-0c48@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=arighi@nvidia.com \
    --cc=changwoo@igalia.com \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=quzicheng@huawei.com \
    --cc=rostedt@goodmis.org \
    --cc=sashal@kernel.org \
    --cc=sched-ext@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=void@manifault.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®