From nobody Mon Sep 28 23:55:41 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 5008530CD85; Fri, 14 Aug 2026 19:36:01 +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=1786736162; cv=none; b=THQg7ctOGiioaYLAWIV9Faq+wEaRAiXK0KRnfExz6oV9DI6oyEt7Y12mugSEIFkt54tpyMG/gE8OrDu/cmO9JXVovVIoEhba5HNAys6noxG3JTMAPJXbepOwtHVfEptnVgSCpkg0BxtEAiGYM0RYhx7BXXwWCiYkmkbITHhpJzY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786736162; c=relaxed/simple; bh=Yv5KsUDfVgd5vJ7iKsVABAWBpD9KokiYNqhXb1wLUTA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=AYQom3yGyZVvdyIi34Ha3DyYWHfCa4o8hwrVNAIyRS+KxRAjGQDLhxxaFuYkmWPMmSJq8mYMXS99rj0wMp9Zahyyn2oL9OFC95rkc8VRylPqHkWyqK0DYq90EKjVZ1x9RNCwnbR6UPwKNbaghpmIVRSzsyXUWRm7bSiXA/md8r8= 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=c0PUDB+D; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=S5M3CwjJ; 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="c0PUDB+D"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="S5M3CwjJ" Date: Fri, 14 Aug 2026 19:35:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1786736159; 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: in-reply-to:in-reply-to:references:references; bh=X0fDsjvOd0Tg3yHfF47XQX4w/5Kns3Wpfvmiby+/wbQ=; b=c0PUDB+DhqRir4zl7VzvR2HXcrIvJ2kUNpS4KszwGCWfQws3qU7wHaSkN4Jqs901skZeHC ZZs2q5m5jPq1uiBXHnB5xItCldveb+Vysa0wiBdugzQxVflWOSvp8L0/1i898g8RRpZtHk 4l5/GgzL6Fvn0gWikwF+boWh0xLExeHturFF/GJInoVjD4qR8T7hnglLbesNt60gHwdyjj xxL0cHc9M07zgXtbsr8K0txHGjf4zEWpOl4CgUW7bTSfFjn8X8kEOLyPkU7j7C1IW2Qt03 88ot5oRNKcoRHqPn7M41kghrdIxqrU7kmg/SuESMXvItzHjlIQH41KZRlgR1FQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1786736159; 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: in-reply-to:in-reply-to:references:references; bh=X0fDsjvOd0Tg3yHfF47XQX4w/5Kns3Wpfvmiby+/wbQ=; b=S5M3CwjJYgaCUiVi9fIEjOYBU3RqlM4YrwpK12QOsTYF1Ur+ISQIyGP6ERfrAol03vSC70 52iGQgEaWBYmkBCQ== From: "tip-bot2 for Vincent Guittot" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Fix flat hierarchy Cc: Vincent Guittot , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260812125039.1717249-1-vincent.guittot@linaro.org> References: <20260812125039.1717249-1-vincent.guittot@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <178673615753.442315.4575538493973476588.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/core branch of tip: Commit-ID: 68e37487810a3da43c48340fab7a55b3b6efdae3 Gitweb: https://git.kernel.org/tip/68e37487810a3da43c48340fab7a55b3b= 6efdae3 Author: Vincent Guittot AuthorDate: Wed, 12 Aug 2026 14:50:39 +02:00 Committer: Peter Zijlstra CommitterDate: Fri, 14 Aug 2026 16:13:02 +02:00 sched/fair: Fix flat hierarchy When a fair task is enqueued, we must update curr and more precisely its vruntime before placing the enqueued task so avg vruntime will take into account the last exec phase. Example: TA is an always running task in cgroup G0. TB is a short running task (cyclictest) in cgroup G1. The lag of TB always increases up the clamp limit because TB is placed before TA(curr) is updated (since the last tick). When curr(TA) is finally updated, its last exec phase provide positive lag to TB Because TA and TB don't belong to the same group, enqueue_hierarchy() will = not update TA's entity when updating curr but only G0's entity at root level. The same applies when dequeuing. This is because update_curr() uses ->h_curr, rather than ->curr, and theref= ore, while it is invoked on the root cfs_rq, which contains all the eevdf bits, = it does not do the right thing. Fixes: 85570f10a4c6 ("sched/eevdf: Move to a single runqueue") Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Link: https://patch.msgid.link/20260812125039.1717249-1-vincent.guittot@lin= aro.org --- kernel/sched/fair.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8a8247b..f79fcba 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7903,8 +7903,6 @@ requeue_delayed_entity(struct cfs_rq *cfs_rq, struct = sched_entity *se) WARN_ON_ONCE(!se->sched_delayed); WARN_ON_ONCE(!se->on_rq); =20 - update_curr(cfs_rq); - if (update_entity_lag(cfs_rq, se)) { cfs_rq->h_nr_queued--; if (se !=3D cfs_rq->curr) @@ -7958,6 +7956,15 @@ static unsigned long enqueue_hierarchy(struct task_s= truct *p, int flags) return weight; } =20 +/* Update curr's vruntime before placing entity or updating lag */ +static inline void update_curr_eevdf(struct cfs_rq *cfs_rq) +{ + if (!cfs_rq->curr) + return; + + update_curr(cfs_rq_of(cfs_rq->curr)); +} + /* * The enqueue_task method is called before nr_running is * increased. Here we update the fair scheduling stats and @@ -7985,6 +7992,8 @@ enqueue_task_fair(struct rq *rq, struct task_struct *= p, int flags) if (!p->se.sched_delayed || (flags & ENQUEUE_DELAYED)) util_est_enqueue(cfs_rq, p); =20 + update_curr_eevdf(cfs_rq); + if (flags & ENQUEUE_DELAYED) { requeue_delayed_entity(cfs_rq, se); return; @@ -8105,7 +8114,7 @@ static bool __dequeue_task(struct rq *rq, struct task= _struct *p, int flags) =20 clear_buddies(cfs_rq, se); =20 - update_curr(cfs_rq_of(se)); + update_curr_eevdf(cfs_rq); update_entity_lag(cfs_rq, se); =20 if (flags & DEQUEUE_DELAYED) {