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 7E0801E98EF for ; Wed, 22 Apr 2026 22:20:54 +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=1776896459; cv=none; b=Sokfw2y2P2oZVe5F7qYrh3Ai5/gVyo1eeJ/G3fWLuqMFgCbSk5/dTL8iOYb5rTUNCJRlEnnijTg4v6zz/cTOgOIYpDhrJ42HTco88m79JS5N103ZPsn8JBjpQ7Zl+OsMl+07LXfMn/e2JFcQZ5lhcqW4MoQ4bWbt+em6tFwws60= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776896459; c=relaxed/simple; bh=YsZ7yiUAmViqDkcLd1ftMHlO1kyceG4eFou+0GrvKvQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bnMUMAwL/+cBW5t0ZK/H7UZjWKnbdBzpOuAmsN/n4o1DClR7I1OgbCN3sLJVd5vR4pe8iJKNYZBAVDEZg81btLCwm2IXGktPBfwRllwPFjzaHFImSUCCaBJBoi5lkETXJKxdhuoVS9rd7jm4SPAnT6yv82ljUf7WkEyDPTtzLSQ= 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=DSVl9eq2; 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="DSVl9eq2" 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=H7OFcah8gTvMQS1gqmkNRXC3wBMQ8bbe335BLZ/t6+U=; b=DSVl9eq2Vl+lV3zXMNJA9l9kb0 Yqkf7v1HQoucl6+Wgq9aPDIZIQShnadjneo0DZ+2RSYoTyFdjgXdNe9lIAROviCufP0+Kd2qw26m5 0fp1kShiT44oTi7fmamHXxNanzV5ufJ7epltVogxYCFo5k/Xqiokh/VHRu5pii7it6JUuoQ4cwN/H YDkizGuYfF5X9Ek8xZLt7zIlMe+U/b6bSuaW5hq9A3pZdoCH3jdUy2X/Lm4EikWu+YnrdzvZb4mwC 3li74lXvSGt2sb6ey5eNoBbjlrbAtWYSXsxUcMvxujtm+0ylFokqG6LkfsP++IGjLu5BMh4sLXtRl bY0AzU+g==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00: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 1wFfw5-0000000CP40-3Q6R; Wed, 22 Apr 2026 22:20:46 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A18B1300EEF; Thu, 23 Apr 2026 00:20:43 +0200 (CEST) Date: Thu, 23 Apr 2026 00:20:43 +0200 From: Peter Zijlstra To: Vincent Guittot Cc: mingo@redhat.com, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, shubhang@os.amperecomputing.com Subject: Re: [PATCH v2] sched: fair: Prevent negative lag increase during delayed dequeue Message-ID: <20260422222043.GB3179637@noisy.programming.kicks-ass.net> References: <20260331162352.551501-1-vincent.guittot@linaro.org> <20260402131359.GZ2872@noisy.programming.kicks-ass.net> <20260422133914.GP3102624@noisy.programming.kicks-ass.net> <20260422142410.GS3102624@noisy.programming.kicks-ass.net> <20260422142828.GJ3102924@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: <20260422142828.GJ3102924@noisy.programming.kicks-ass.net> On Wed, Apr 22, 2026 at 04:28:28PM +0200, Peter Zijlstra wrote: > Let me ponder this a bit... Like this? Or am I still making a mess of things? AFAICT this is the exact same as your initial version. --- diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 69361c63353a..24e8c78b110a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -847,13 +847,13 @@ static s64 entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 avrunt * Similarly, check that the entity didn't gain positive lag when DELAY_ZERO * is set. * - * Return true if the lag has been adjusted. + * Return true if the lag of a delayed entity has been adjusted. */ static __always_inline bool update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se) { s64 vlag = entity_lag(cfs_rq, se, avg_vruntime(cfs_rq)); - bool ret; + bool ret = false; WARN_ON_ONCE(!se->on_rq); @@ -862,8 +862,9 @@ bool update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se) vlag = max(vlag, se->vlag); if (sched_feat(DELAY_ZERO)) vlag = min(vlag, 0); + + ret = (vlag != se->vlag); } - ret = (vlag == se->vlag); se->vlag = vlag; return ret;