From nobody Sun Feb 8 23:06:16 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D76B2C11E1 for ; Wed, 21 Jan 2026 16:33:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769013205; cv=none; b=hifPaqYXWKO/DNTf393HZ1Yt2Hn+w4AohPc6B+MSap0u3tZ/Is9UQ0WouyCBbbT3OW1DA+Uh7YtAV+jgvDId0rUR7ueCwf/qyBbTgOSK+8DicmQjAxPIC5bQ9MGf1bFv3axaIxisGYCS4+cos3R9WLqvsSwjZSWDZAysVXZBwxA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769013205; c=relaxed/simple; bh=NHSU/EeUuWCMB2e0yQetCyv1qdIkm/BXiUbMRgagTdw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OYvn1prHLJse+8fBvU0+l01HX2RbSPM4XAtWJSq7Tl6x/9HbJfjTbKwVDI0NebvUZBFZYi9hZiTAmRKmiYhmQfczo4rEcvhhum7lAeSJoqkG1YTKLlJJq5qIHnZvQS7zRyiXUGAI7PTU4XKPqOB8E5XDT10iFbEULUdyXjgFrRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Nryya8wf; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Nryya8wf" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4801bc328easo322015e9.3 for ; Wed, 21 Jan 2026 08:33:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769013200; x=1769618000; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=F6ppS1IvLKqfHTseXyEM0zOg97DZeawFMCl1e5ApnhQ=; b=Nryya8wfdVG41s9/NRDEXvWw7kUu6i5HP+CGVQbyQPllKIXVAWoQd6V6Bdb+m33J31 P7qe1QnNDcpHZRMZ6SscwNHVsoNypWDkC9bf/0G0MqD/QpXaRIzqBfH6X1bmiwtt/ycf sukkxNKxXR7UKM17N5teeinJW7t8tllKtf2kI+qxRew/3GyxjUJYDe8HudbnCfku0aN4 jdS/Swyu6cgJcKWolqn5ga0AZsjwh3emMd0BkaBjNI7UA729s77LBIyUWAqNOY5iZZjG aho1BLz0JDS7O9anjGhXzi4V7CleLX4pcR1LA9aLmjG8ife+P/viMnGwbLP3XqKEIy6V Yd/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769013200; x=1769618000; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=F6ppS1IvLKqfHTseXyEM0zOg97DZeawFMCl1e5ApnhQ=; b=WQyKdyQM9UqSaPbz7LDb316BknbZvUN/soWWCGB6Zt8oKHCGI7p4wL+56YQyLMCZXt /JNCFa8r+IgnOKGFYEp44EUqEJ7JfZm66dVl1AOAYDIVnflgMisaSGFWQxTlDa0sAVUy /pj/7F72ZQuQG6UGhJ0zf3HKpLCXnvjnS6vCCZLE+RZebsg5NZCvWr/mQfeu/wy4KszS pWnZC0RtkqAKbvsEbf38mF0WwInDxFKY8mwBooYM3Z9k5cZPtBSCSnTFFias0iapujC0 P9gjfzJzOvzFw44v2OdpKfVWT6E7rYJ5OMEkRid7VeUbL56raJyoTaD0yb183Ec7CIzQ yNRg== X-Forwarded-Encrypted: i=1; AJvYcCVpQY2iUI4nHBgJK3aK18IXlV1pJItApeHiP1DuaGBU3gHK7ujjjW4rCYLT4LJF8gxqhBoxUZqDzZVL27Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yyr38TW2xmXXhV+VMHGUmLVaJ/mwlKOxCjVkbbZxDsyEHTSVgoC v8d79Ld5qNx6ME/aOZ+D5oLX9bcjI065Kt3+VHAAGv6SSF7yzXRCr/MXKqeFXnvD8rQ= X-Gm-Gg: AZuq6aJEaq0lp98akLbJgoUYPWTLM+O7d0U52jkUixcrnR83sJembEKtGb0EPzZoUGr y1WEdj1wObSYTLBHrqRZKGkUSdDQ3lh3MfcdNjW3U21eJHgJg/LUi5T0ksJ5sOgI10wsBRROUCX 9i9yxRqEBAkvWUuZFB0XwwIAMDo+UVNPLgO0vUWV5jVRv3tZWWJz3/MGS2VFUW4s/ZoDzGKmQhJ lOTye4IscCenFA9pdvGVzWe7exl4mUq29+UxUk1kirPtKAYUVXtekBWIt8EReP+GGW8FYgQ7d2G VR7OtIjqpkzNwG0XKVyKyNoi7/kLNv2H59JV1Ix5s8ZL0gsoq+BRpfNi5kKLIf5XOM2M4axe5gD q8AE59GNf6qDI2ZR1d7btHc7ldVVBkywOLEfa9mOp53fiXUE+xeSzCbtwUukDs9463oa84Z5NLr bKoSBQs66AUes8o5Dn+g== X-Received: by 2002:a05:600c:3495:b0:477:639d:bca2 with SMTP id 5b1f17b1804b1-4801eaadbd9mr234831565e9.4.1769013200371; Wed, 21 Jan 2026 08:33:20 -0800 (PST) Received: from vingu-cube.. ([2a01:e0a:f:6020:a01e:c417:d2f:6933]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-480470403d3sm493745e9.5.2026.01.21.08.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jan 2026 08:33:19 -0800 (PST) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.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, wusamuel@google.com, Alex.Hoh@mediatek.com, qyousef@layalina.io Cc: Vincent Guittot Subject: [PATCH] sched:pelt: fix pelt clock sync when entering idle Date: Wed, 21 Jan 2026 17:33:17 +0100 Message-ID: <20260121163317.505635-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.43.0 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" Samuel and Alex reported regressions of the util_avg of RT rq with commit 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection"). It happens that fair is updating and syncing the pelt clock with task one when pick_next_task_fair() fails to pick a task but before the prev scheduling class got a chance to update its pelt signals. Move update_idle_rq_clock_pelt() in set_next_task_idle() which is called after prev class has been called. Fixes: 17e3e88ed0b6 ("sched/fair: Fix pelt lost idle time detection") Reported-by: Samuel Wu Closes: https://lore.kernel.org/all/CAG2KctpO6VKS6GN4QWDji0t92_gNBJ7HjjXrE+= 6H+RwRXt=3DiLg@mail.gmail.com/ Tested-by: Samuel Wu Reported-by: Alex Hoh Closes: https://lore.kernel.org/all/8cf19bf0e0054dcfed70e9935029201694f1bb5= a.camel@mediatek.com/ Tested-by: Alex Hoh Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 6 ------ kernel/sched/idle.c | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 108213e94158..bea71564d3da 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8989,12 +8989,6 @@ pick_next_task_fair(struct rq *rq, struct task_struc= t *prev, struct rq_flags *rf goto again; } =20 - /* - * rq is about to be idle, check if we need to update the - * lost_idle_time of clock_pelt - */ - update_idle_rq_clock_pelt(rq); - return NULL; } =20 diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 65eb8f8c1a5d..a7c5676b9abe 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -468,6 +468,12 @@ static void set_next_task_idle(struct rq *rq, struct t= ask_struct *next, bool fir scx_update_idle(rq, true, true); schedstat_inc(rq->sched_goidle); next->se.exec_start =3D rq_clock_task(rq); + + /* + * rq is about to be idle, check if we need to update the + * lost_idle_time of clock_pelt + */ + update_idle_rq_clock_pelt(rq); } =20 struct task_struct *pick_task_idle(struct rq *rq, struct rq_flags *rf) --=20 2.43.0