From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AD5813D891 for ; Tue, 2 Dec 2025 15:19:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764688766; cv=none; b=sgpA0BeUeXAVg2JncMZ6SI/qLpg1wHVsHxGYJC+YNqmJaFXGAByJ57cZFTEY8gz4/bCp4YbdLQq+aD+BN0ilyOp53l0OL6v1gOTPUvb2zKfz/YAMZ3eGV+OKO3z3Qn35iD+VwPiH5NhVYSNHmGeYLc2kmS7N393MYuM/Q/oRJQs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764688766; c=relaxed/simple; bh=pyKT4Ya4Jj1C0E5rc41rjUGkSMC9iFkGnKU4159GCMU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xr4Aw43EXYfEEWjSPPmljobxCufS/U6iLnHr8QR3NioZGUjH4YnTOfM2hto+gnilYoO+U1btTtiO1Ucr60nC7LxO8ZgBlyvMuMmdOVzePB8QI/RFOH14HkKlQpLMLaip8048hugbcB0HzKCq5K+977827TZ35vosA30nL2SZRrA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bVbcZE8j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bVbcZE8j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65DF4C4CEF1; Tue, 2 Dec 2025 15:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764688765; bh=pyKT4Ya4Jj1C0E5rc41rjUGkSMC9iFkGnKU4159GCMU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bVbcZE8juyl9E75SHEZ9qT8hF7vNn4+oiOC/6ecmbeNWaCjUDHqNxAkYOpMz1vKve PHVIAc02BNqb5ownBXRIWY7Se9zJ5MvIVyB9MASe0/UujXCVho56+HccbQtJrVW4ua 1lbN6c1+ODUw8xFh7b78sZloVgcmaSxqrd+Z2OiN2/eLAMtktDSPiPq4QuD8XhCyUX d6fpTSY2AW5Awtc6oWvhBVY/0HKBGPIpTbMo3x8ON+hN3HtmnidtSHTyh5FtJCrPQf wXn82H8uWuorOxN6dOx6JUi9BYFlMeDXsce1kmvCrqhPGC/fMGmhm4ifFtgXNjXoj6 ohl8IzZ6rpk5Q== Date: Tue, 2 Dec 2025 16:19:20 +0100 From: Ingo Molnar To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Juri Lelli , Dietmar Eggemann , Valentin Schneider , Vincent Guittot , Shrikanth Hegde , Linus Torvalds , Mel Gorman , Steven Rostedt , Thomas Gleixner Subject: Re: [PATCH 6/6] sched/fair: Rename cfs_rq::avg_vruntime to ::sum_w_vruntime, and helper functions Message-ID: References: <20251201064647.1851919-1-mingo@kernel.org> <20251201064647.1851919-7-mingo@kernel.org> <20251202103501.GC2556898@noisy.programming.kicks-ass.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251202103501.GC2556898@noisy.programming.kicks-ass.net> * Peter Zijlstra wrote: > On Mon, Dec 01, 2025 at 07:46:47AM +0100, Ingo Molnar wrote: > > The ::avg_vruntime field is a misnomer: it says it's an > > 'average vruntime', but in reality it's the momentary sum > > of the weighted vruntimes of all queued tasks, which is > > at least a division away from being an average. > > > > This is clear from comments about the math of fair scheduling: > > > > * \Sum (v_i - v0) * w_i := cfs_rq->avg_vruntime > > > > This confusion is increased by the cfs_avg_vruntime() function, > > which does perform the division and returns a true average. > > > > The sum of all weighted vruntimes should be named thusly, > > so rename the field to ::sum_w_vruntime. (As arguably > > ::sum_weighted_vruntime would be a bit of a mouthful.) > > > > Understanding the scheduler is hard enough already, without > > extra layers of obfuscated naming. ;-) > > > > Also rename related helper functions: > > > > sum_vruntime_add() => sum_w_vruntime_add() > > sum_vruntime_sub() => sum_w_vruntime_sub() > > sum_vruntime_update() => sum_w_vruntime_update() > > So vruntime := runtime / w, so w*vruntime is runtime again. I'm sure > there's something there. Haha, yes. It's delta_exec all the way down, and turtles. > /me runs. > But yeah no arguments this naming needs help. > > > With the notable exception of cfs_avg_vruntime(), which > > was named accurately. > > But the old avg_vruntime() name was good too! Yeah. It's now restored in its old glory. :-) Thanks, Ingo