From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 225E930F7EF for ; Tue, 2 Dec 2025 10:35:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764671711; cv=none; b=KtIMWLWm2S1QwfmiL8gCx3P6iPaAGuQsin63WtrvPa5URhuItQzQXXNCgaxLl56JZEcuCnrwie44uU11N2vWqCxhWsRL4ISYeH6Q7SXxSJGbQyK+8/JBQKtoEZx25x5X6MSfKB87GIRf9VmnKXcuVH2CHkMsqi4Ag82SQL0PWO4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764671711; c=relaxed/simple; bh=5kdJg5oi5fThxSZQXZBIKnAJiN9uKVLlqEE29OJ/XsU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rKkkbhBF6Qxl0vUz9W14yMPnHoKWB1E7Wn6Oi0iyd1FrHX2NLE+P9eGhUw0r67E1rh9jnyRAX0rX4HF1bf69t05uVHH/SPvg1c2Y8ig/n/fsFZe66Yo/TEViLaulGmefxYGeLc8627UrlMa76vbss+MN37/ob2Q1Q9qmYJiEgOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=IKZBzvaQ; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="IKZBzvaQ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=sCosCOiZFuy12v71pidiZNNJy9mUFqlfP813Ae9PQEs=; b=IKZBzvaQSx9sUfww114IDnfqSJ f15qRBYOdi7wW/EcYlGgsFf1Aq73+D82MwHXBDqzTMZnaYFZuNtznv+Gz5jFLJbXGxImad5/ISjP9 pf38WJAuY0gRuRDj3gls7FoMq0FHYis8R096WOgSo/fiQA+7CLMupOfhP825GlqCRF8yhDLi30qmf xANiN/QfMZSAeR4GuMElExY+Gn/+8OSDTp8uBB2js+M/Pgpme5QFnUsu8x5TyAqgoGVO+SO16GUYb ZnVLF9Fp6L3bxcBPD+MI/EDRcOikLEZNglEibPU33BRK9OOf11lDUFZ/RzdcEXUWRNCurBBgLWCpK F+57c4Yg==; Received: from 2001-1c00-8d82-9800-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d82:9800:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vQMrF-000000008L4-3f2E; Tue, 02 Dec 2025 09:39:41 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id CAD3030027B; Tue, 02 Dec 2025 11:35:01 +0100 (CET) Date: Tue, 2 Dec 2025 11:35:01 +0100 From: Peter Zijlstra To: Ingo Molnar 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: <20251202103501.GC2556898@noisy.programming.kicks-ass.net> References: <20251201064647.1851919-1-mingo@kernel.org> <20251201064647.1851919-7-mingo@kernel.org> 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: <20251201064647.1851919-7-mingo@kernel.org> 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. /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!