From nobody Thu Apr 2 20:26:38 2026 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 628E0339B32 for ; Thu, 19 Feb 2026 08:11:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488664; cv=none; b=Q2vOChkify7uVKUHjcRHr6bJs3pnPsXYVoW8QKEbBnq80Ae09wphjUBD0sQY3K//uxBLw8Gkv18nMxHwC23R+92Y52qHYu4HNOmN1pRuKEK89ixNbNZ9o7e7S/1u+7GzQF+qCxFo7K4YiZPGTXdow+OshCuuHHvvlghfZAw2Yjg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771488664; c=relaxed/simple; bh=fxRLlNZud3hxlrMgKFhDc5KjXfN+IA7SN2Kf2PU8yFY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=OPiSAke5gno0uTcav+tULIsg0Np3fex34Z40xV2w5LsK+rHmD2nbI9BioGVVxtdf//yxNdWUgcEm1QEohM7YELU6VyFZX5/nAKM/TWd+Eqq931wGFZDKEMAzZjoGagEt9nEjFLklSmIOVHjAVpDt7gm8Vsy1ksbKTnCe51BXwTQ= 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=a3BAQIUO; arc=none smtp.client-ip=90.155.50.34 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="a3BAQIUO" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Type:MIME-Version:References: Subject:Cc:To:From:Date:Message-ID:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To; bh=tZXhfbfUSMYtydXUZF4P0kDtIfEYQ2UqVUCaxsBwATg=; b=a3BAQIUO0gKxdRXQBBGN4eTJfl iO67SmY8S/EvV1uTDX/2vQ+q1UHpVe+cvmWtL7cGrpxQjaRem9y98yC9srSAWlI8NwSPHjf4DLlCn tWjJXaAe5fctVWnbZj5EeQn8qLrUL+DAecVefCtiGLgQE+Yu0NetuOOexidv2aChQjNId2b+X0yKY sxyXBrERv8SSM5n2QemUPiVv2rLlBuf/KWEgAN5rSqsdudxyLuwx7/wEgf59wnzOe5ckkEquacdbq glYnmJySzpAOdFykG9QQQhLQy4WiWJJ0B/xsH8+OWKB47Yy8+NhTEr7ahNHqHwLy/pPx87e/oshi5 TbyrVHnw==; Received: from 2001-1c00-8d85-5700-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:5700:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1vsz7a-00000007KJ1-0i1U; Thu, 19 Feb 2026 08:10:50 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 0) id D5D16303369; Thu, 19 Feb 2026 09:10:48 +0100 (CET) Message-ID: <20260219080625.183283814@infradead.org> User-Agent: quilt/0.68 Date: Thu, 19 Feb 2026 08:58:47 +0100 From: Peter Zijlstra To: mingo@kernel.org Cc: peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, wangtao554@huawei.com, quzicheng@huawei.com, kprateek.nayak@amd.com, dsmythies@telus.net, shubhang@os.amperecomputing.com Subject: [PATCH v2 7/7] sched/fair: Use full weight to __calc_delta() References: <20260219075840.162631716@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Since we now use the full weight for avg_vruntime(), also make __calc_delta() use the full value. Since weight is effectively NICE_0_LOAD, this is 20 bits on 64bit. This leaves 44 bits for delta_exec, which is ~16k seconds, way longer than any one tick would ever be, so no worry about overflow. Signed-off-by: Peter Zijlstra (Intel) Tested-by: K Prateek Nayak Tested-by: Shubhang Kaushik Reviewed-by: Vincent Guittot --- kernel/sched/fair.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -225,6 +225,7 @@ void __init sched_init_granularity(void) update_sysctl(); } =20 +#ifndef CONFIG_64BIT #define WMULT_CONST (~0U) #define WMULT_SHIFT 32 =20 @@ -283,6 +284,12 @@ static u64 __calc_delta(u64 delta_exec, =20 return mul_u64_u32_shr(delta_exec, fact, shift); } +#else +static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_= weight *lw) +{ + return (delta_exec * weight) / lw->weight; +} +#endif =20 /* * delta /=3D w