From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796399065; b=YJOS2dDvPS/9WAYTpEmhcsta90nFpt/Kuq550WXUMI4dkJiE3F+vDpV2vzPlkKwdE9nH Dl7+ZopxSf/mkQtmPOG1k6nM5rpyylQHZfZt/fVjtGDv516M5JNTz5RE4mY8NAlKCjFz1 m9OTj5ZirRN0QcNcn42ygDEqm5H4qRbhAO8OZ0a7P33u5Kw8+70Pq66EKdNJFzJKbu9Os BJQaa//I5zvx2RgZRZqLdONqmJiyAg3Iy6cbIMojg3pY6kayHfOPEvXUmt70O5qLCtgUa E0WA0TlNd7pM4NqGrYB1I6pfSr/zGGDPSRlefpxdUjMgW0+kxWZV1EFEL2pCwg9hFGQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796399065; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=wp91ksbyXSOEGDx7o9zN6GZefauvew/r7X+YZ+Bx2So=; b=CVh7/zNh6pQK3Pu2GcrU8LoJ/7nPBuwtaBXm2r4e8sOFqBloym6LFIHcVjX0kdR7H07s q530IrfY+BdN+xKN39QlRx1fIBg5KnB18p8C//IgnJho4O1nDIeEBNMbRYrdPARf+FZTB Aw/3g4WoOmWXAwtFcgFD3KQVzHIkXhVlgA08/1IrenIsXDHt1MO7gpXbuEeUVjHXIhQmX YEeylir2Kn8HAEWhelU4MZCmayfqhUh1q8CmMsNvUpKicHF+X1PxgGzIXFFLFEPyxrQsQ h7NpJlsuhfB3csYQuO0XU1aX4tKOABhPxfBRp145r7PFhtoptQwCfwwTmh1jfQHU6wg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="O/vj3NsP"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4969606A339; Fri, 4 Dec 2026 15:44:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=O/vj3NsP Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3161F00931; Fri, 4 Dec 2026 15:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796399064; bh=wp91ksbyXSOEGDx7o9zN6GZefauvew/r7X+YZ+Bx2So=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=O/vj3NsPEjmCPInjDOjoUBSqj/+g+qS9ihaAai/74G8QZlvdJnprVJ2pcHlMwDhZN eg48ITfPwKHBb9yMrsY71vF8f6+9CpJ/ZxnTkLLlvQYClWBDNAVHVfzTnZ6HOTRDtl EyxtZvVmL+a5mxCn8k2xZ9va26NiJzQLdRkmbC8eXT5PFJcNjelaqqYR2+R0Jiil3f xf7vrAuXAbIOBADuJUCFJwQPGMonQIfjEnTvgoyz+P/3AiaJs+XIvxA+2P6/V0ISuB 0tXFfwSVfzOH5tCKBQifh1g8o/1+xIqoWNgw6v6Ku6AX+dmF8rMkrYKtYRc2E3cg6R DsD5GrLSwyeSQ== Date: Fri, 4 Dec 2026 05:44:23 -1000 From: Tejun Heo To: Andrea Righi Cc: Steven Rostedt , LKML , sched-ext@lists.linux.dev, David Vernet , Changwoo Min , Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Linus Torvalds , Jonathan Corbet , Greg Kroah-Hartman , Sasha Levin , Zicheng Qu Subject: Re: [RANT][PATCH] sched_ext: Fix stale fair load weight after renice under SCX Message-ID: References: <20261204093507.424049cf@gandalf.local.home> X-Mailing-List: sched-ext@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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) > > > > 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