From nobody Sun Feb 8 09:27:48 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 95D3F235063; Thu, 23 Oct 2025 17:13:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761239581; cv=none; b=kxGiRKw/Md37sMb89ejiVzi29rHUlmJ/Fzj8DDCBIQIPMZYLS0e+jbC1QOTZ5ITZXgwBGxbofFu+FMsKBrj+oVlFha5xtT+++aXpQmgp27CLpDgJthyWISBf6DO6v/kv0dWKfTk5h/W2fIaG2Z3Lh5NzrGQePoqpOur2EHNJrZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761239581; c=relaxed/simple; bh=uThquYsLE/eESBSNMrBv+gcGJQb1x5hHE3EyT9MbTp4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ltiff9GFgoc6UTd6THzzWnVLs8kpUnDurn8oz5DaO1JUpaGj+CI2T2HSNWaZYcMXyylWPFiMjhm/oST4MJPfNBfri1ao6S8klH0E+F+Pr/zxKWK6uoNOGWZGo/YJMSMfjefPAXOcKePgeaWV6HEDM8eQgCWR09ya0jdG0Dwgmo8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sc1j2XTj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Sc1j2XTj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02251C4CEE7; Thu, 23 Oct 2025 17:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1761239581; bh=uThquYsLE/eESBSNMrBv+gcGJQb1x5hHE3EyT9MbTp4=; h=From:To:Cc:Subject:Date:From; b=Sc1j2XTjrruOB6MUoCqJOu6NtZchvbHwLKK7U/10WUVPmQ7Qd4CYOOdTvyE2cG1Kj NM20Wg1k1qhn2kA0EwVuZlBuyOt5jB4qubpruettgccxK6UVrKt2bXr5n/gNoqyW3W OHjCIGfTcNipWlHyX0LiLQkCPrk6WOgqKEFU4TGO4Qbqs5leLvO5FlJ4y1Kc8guoz2 oYG69cWhaAJFU5It5O5Pk+oUFoESXuSObsJeTiWhyRqBGaL33wh9S5uM52s01QiuUp miCkmuEYKibTIkZy9Fk3iejGD2bjWVhADW4YfSZBcXV9OmHp6s9+BilyGChEuUanBm QLu1TlQXFw5fg== From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Doug Smythies , Christian Loehle Subject: [PATCH v1] cpuidle: governors: menu: Select polling state in some more cases Date: Thu, 23 Oct 2025 19:12:57 +0200 Message-ID: <12786727.O9o76ZdvQC@rafael.j.wysocki> Organization: Linux Kernel Development 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" From: Rafael J. Wysocki A throughput regression of 11% introduced by commit 779b1a1cb13a ("cpuidle: governors: menu: Avoid selecting states with too much latency") has been reported and it is related to the case when the menu governor checks if selecting a proper idle state instead of a polling one makes sense. In particular, it is questionable to do so if the exit latency of the idle state in question exceeds the predicted idle duration, so add a check for that, which is sufficient to make the reported regression go away, and update the related code comment accordingly. Fixes: 779b1a1cb13a ("cpuidle: governors: menu: Avoid selecting states with= too much latency") Closes: https://lore.kernel.org/linux-pm/004501dc43c9$ec8aa930$c59ffb90$@te= lus.net/ Reported-by: Doug Smythies Tested-by: Doug Smythies Cc: All applicable Signed-off-by: Rafael J. Wysocki Reviewed-by: Christian Loehle --- drivers/cpuidle/governors/menu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -321,10 +321,13 @@ static int menu_select(struct cpuidle_dr =20 /* * Use a physical idle state, not busy polling, unless a timer - * is going to trigger soon enough. + * is going to trigger soon enough or the exit latency of the + * idle state in question is greater than the predicted idle + * duration. */ if ((drv->states[idx].flags & CPUIDLE_FLAG_POLLING) && - s->target_residency_ns <=3D data->next_timer_ns) { + s->target_residency_ns <=3D data->next_timer_ns && + s->exit_latency_ns <=3D predicted_ns) { predicted_ns =3D s->target_residency_ns; idx =3D i; break;