From mboxrd@z Thu Jan 1 00:00:00 1970 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 6DF2033F39E for ; Wed, 11 Feb 2026 16:28:40 +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=1770827323; cv=none; b=eUYi1cPis8/3Jx44sICwkuWd4/Besx73QD/+wwFEyRtRxyIpl4EMjdeK3VJS4XPFwMgSKpKxtsWEEeXI4ES+z3zES3Gf3Wf9G1UnsUjbUm+cqsogQ6m6Y5uJk4oJVsJowITnqN6Voiy4cW4r7QEnZyviEbWRiz+JuWbloH6c6Os= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770827323; c=relaxed/simple; bh=NVLNlTnDQJDKkq/Q9VOE67ojm3OmOp7j8SYRwNkMOOA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NrgXPaKuTHE8XE4EhsscbW5hYNCMJUKXr7MDT0afynalc1/vmdw4GkiXfKzsw2RjdeWkDcWcFaadw2Qe5jpKUoOLi6dKqmAS1hleP3qenL9lAJEkkcWG/75LSC5X0YfjEqh7PkHi3oOHvNh+0S2ldbb9uEzbZO+0KZf80+wNFWY= 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=F96EEt+n; 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="F96EEt+n" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; 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=rT43IilUTnGVcUM3ZgdMRy8klIGCPo8m4kt5HAz5Bh8=; b=F96EEt+nx9qREX+B/VyW9OZvpm 3KjkKNBKXocNUW5nWS4b+6AVuhp+TLaPu66jhevsMz0FUT5FVbD9n4Uho9eJFWP1Ctbc4GUuafwn3 W5ptF3Jg5AHXd0MyqHMefttDdhiGrwpsxoNa0akvGt9sSvMPxPDhXfYWusMBro4E0LXz68974HmDg zfYA6YH2JjF8LGyI09nDCwvxOVDo83a6okzK2qhUR8VvnI0uwBZ90VQNBmDM/XmPBtV+WUu+No8RJ +k6TWdcHgRMd0hpOwuOrzKE05JVRqaeoD+/PgZ5iep/KYrDaK62DlX6iP4MXeKAU12DyiGqcJGzIT hkfJZHow==; 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 1vqD4k-0000000CuAR-2IbW; Wed, 11 Feb 2026 16:28:26 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2BCD3300FB6; Wed, 11 Feb 2026 17:28:25 +0100 (CET) Date: Wed, 11 Feb 2026 17:28:25 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: Doug Smythies , K Prateek Nayak , mingo@kernel.org, juri.lelli@redhat.com, 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, wuyun.abel@bytedance.com Subject: Re: [PATCH 0/4] sched: Various reweight_entity() fixes Message-ID: <20260211162825.GZ1282955@noisy.programming.kicks-ass.net> References: <20260203111134.GL1282955@noisy.programming.kicks-ass.net> <38ef3462-4c4e-4f40-8d63-84dd71cbd043@amd.com> <20260209154718.GW1282955@noisy.programming.kicks-ass.net> <002501dc9b16$442a7050$cc7f50f0$@telus.net> <20260211090144.GY1282955@noisy.programming.kicks-ass.net> <20260211104833.GH1395416@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: On Wed, Feb 11, 2026 at 12:15:48PM +0100, Vincent Guittot wrote: > Regarding the use of calc_delta_fair() in update_entity_lag(), we use > calc_delta_fair() for updating vruntime, deadline, vprot and vlag and > I wonder how this diff of granularity compared to avg_vruntime can be > an issue for sched_entity with a small weight It will effectively inflate their weight. The below seems to 'work' -- it builds, boots and builds a kernel. We could perhaps look at doing that reciprocal thing on unsigned long, but meh. --- Subject: sched/fair: Use full weight to __calc_delta() From: Peter Zijlstra Date: Wed Feb 11 17:07:58 CET 2026 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) --- kernel/sched/fair.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -259,6 +259,7 @@ static void __update_inv_weight(struct l */ static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight *lw) { +#ifdef CONFIG_32BIT u64 fact = scale_load_down(weight); u32 fact_hi = (u32)(fact >> 32); int shift = WMULT_SHIFT; @@ -282,6 +283,9 @@ static u64 __calc_delta(u64 delta_exec, } return mul_u64_u32_shr(delta_exec, fact, shift); +#else + return (delta_exec * weight) / lw->weight; +#endif } /*