From nobody Wed Jun 17 04:16:06 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9E61D3F23B7; Tue, 28 Apr 2026 07:26:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777361169; cv=none; b=MVRIToecWBUS3+qTHbjx8XeAtCjdtJCj74La3ENmgmpTiYR5l3ZQM84EozA5BAMMqPNxiuI/Ms7VcfkEl0v1gUSW/e6tWPPq2eSKtfrxlFriA4g0G+GEVhYXYEGy/V8eE9qIGWpyjDloyfiuUxWltEItQsDDhJXTOeGYI3fnZx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777361169; c=relaxed/simple; bh=DWtjXpZzIN+XjBBqAik7LQMwKzWyBEW2eQTAAAyGdUI=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=bs4KwLrCuXebs4O6MQoeU3xvDTWxzy34xel/QdB26ZgJ14deOavq3MOGC2+L4k2g8ws8UpsQKSKKUgytJo9ZmPV3taXsN2EVSVqED7CJXO5wSUdU9Q/TioyDe/wRKtBKj5CAFieSoJ11k9/aQul6OzCbs4UdtJbU+8uaqgyjR+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=s6Hd9uwQ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=jGbf/Z+N; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="s6Hd9uwQ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="jGbf/Z+N" Date: Tue, 28 Apr 2026 07:26:04 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1777361166; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wJpFNltGUqhgocrrvpC7seQLnQV0i7HY7nEB4/e6KH4=; b=s6Hd9uwQfdxB85CObjmzhD6fn8BOvDFm92S5dikiiymk8djn1xk79WzJ/SW4R4b5rVuEoE udgN3Uvg21PFGf1Sh9QOvtr1nWQe84B7VIodzVGY04IaX2zmYgnI+tC6xD0yizrChL8kaT s17vPT7kqvyF7FSZtX0KENLRpFBaudKgE1g+VG2rKGbVLUCv/VGFFr/skR41wQsaLUvLPY VrJEhS/r7V8CMR9OBXiQAanpEGni5IFboF29E/RQFKzzXoXK5UNQKnqQxfn7O/LockCbGM MEGabjMZH0puGkTQeM4u4BZsPZaawYVin7/kbbHPaRREtwZvG3GU8WS835CxkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1777361166; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=wJpFNltGUqhgocrrvpC7seQLnQV0i7HY7nEB4/e6KH4=; b=jGbf/Z+N4/Ps0rcett00g6KEqYW8TWxCRNC6FlLW8YRaSYvpCWiv1eSZUljj7sEPo/8dr2 QxPmwafKflkuWEBg== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/urgent] sched/fair: Fix the negative lag increase fix Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177736116478.3521451.16009555891463969361.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/urgent branch of tip: Commit-ID: c5cd6fd75b6a55761337c9e965dd5ad02485d00d Gitweb: https://git.kernel.org/tip/c5cd6fd75b6a55761337c9e965dd5ad02= 485d00d Author: Peter Zijlstra AuthorDate: Thu, 23 Apr 2026 13:22:22 +02:00 Committer: Peter Zijlstra CommitterDate: Tue, 28 Apr 2026 09:19:54 +02:00 sched/fair: Fix the negative lag increase fix Vincent reported that my rework of his original patch lost a little something. Specifically it got the return value wrong; it should not compare against the old se->vlag, but rather against the current value. Since the thing that matters is if the effective vruntime of an entity is affected and the thing needs repositioning or not. Fixes: 059258b0d424 ("sched/fair: Prevent negative lag increase during dela= yed dequeue") Reported-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Tested-by: Vincent Guittot Link: https://patch.msgid.link/20260423094107.GT3102624%40noisy.programming= .kicks-ass.net --- kernel/sched/fair.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 69361c6..615861d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -847,13 +847,19 @@ static s64 entity_lag(struct cfs_rq *cfs_rq, struct s= ched_entity *se, u64 avrunt * Similarly, check that the entity didn't gain positive lag when DELAY_ZE= RO * is set. * - * Return true if the lag has been adjusted. + * Return true if the vlag has been modified. Specifically: + * + * se->vlag !=3D avg_vruntime() - se->vruntime + * + * This can be due to clamping in entity_lag() or clamping due to + * sched_delayed. Either way, when vlag is modified and the entity is + * retained, the tree needs to be adjusted. */ static __always_inline bool update_entity_lag(struct cfs_rq *cfs_rq, struct sched_entity *se) { - s64 vlag =3D entity_lag(cfs_rq, se, avg_vruntime(cfs_rq)); - bool ret; + u64 avruntime =3D avg_vruntime(cfs_rq); + s64 vlag =3D entity_lag(cfs_rq, se, avruntime); =20 WARN_ON_ONCE(!se->on_rq); =20 @@ -863,10 +869,9 @@ bool update_entity_lag(struct cfs_rq *cfs_rq, struct s= ched_entity *se) if (sched_feat(DELAY_ZERO)) vlag =3D min(vlag, 0); } - ret =3D (vlag =3D=3D se->vlag); se->vlag =3D vlag; =20 - return ret; + return avruntime - vlag !=3D se->vruntime; } =20 /*