From mboxrd@z Thu Jan 1 00:00:00 1970 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 4AC7F34B1B7; Fri, 21 Nov 2025 13:37:13 +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=1763732233; cv=none; b=U5N05J1yW3CcKjhF/9fjF9vymsDi/EwRjV2JEc0CiLb3cygP03irkBxOpeEiAh2/bAV4wDGS3qjVS2PJDORu7s7YxrGO+3oMrT6fZsaDSEhxYQKugYZ0zrFcrgsPet4mWFzcVZOB0vBamG5h3uGAGNGV2MWCzJ0GRrEMc7pT42k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763732233; c=relaxed/simple; bh=2GvRhmbnGh2oD1QWcOyK/CrJ4YjYKrDwym5gdbN2gsU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HKBHTwMPVc0rMlg6PaQoJU+oCsHSdcw/TZe162vlh74yHl9lprFIL9tAYPW1kuDqsbRwDeQFkAVDJwe2ZSwx4DNXfr+cz0CQDwccEdPFmqffRs3QKDAed3VPmEkrjM7kB58ptOVcXR6LDTSD1DL2Dgvbj6OYKYcKse9HypDKug0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lHnah9yB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="lHnah9yB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1FD5C4CEF1; Fri, 21 Nov 2025 13:37:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1763732233; bh=2GvRhmbnGh2oD1QWcOyK/CrJ4YjYKrDwym5gdbN2gsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHnah9yBQbiWRmsGk80VcVPFob58uSmTKLJskL9eMWhZSnqI+pEb3M0zp1FmSf2Ch TuCFD7h1eVwj3+92pc0PY5AYVC7tLzyVGheCpQE/odXcw/Cc80Kl1pAJjWHQ4uQ7dw G0kWnYm+iAk9uRUTopxIZPamG7xk9rPxcsQhLcz0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Doug Smythies , "Rafael J. Wysocki" , Christian Loehle , Sasha Levin Subject: [PATCH 6.6 049/529] cpuidle: governors: menu: Select polling state in some more cases Date: Fri, 21 Nov 2025 14:05:48 +0100 Message-ID: <20251121130232.753206150@linuxfoundation.org> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251121130230.985163914@linuxfoundation.org> References: <20251121130230.985163914@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Rafael J. Wysocki" [ Upstream commit db86f55bf81a3a297be05ee8775ae9a8c6e3a599 ] 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$@telus.net/ Reported-by: Doug Smythies Tested-by: Doug Smythies Cc: All applicable Signed-off-by: Rafael J. Wysocki Reviewed-by: Christian Loehle Link: https://patch.msgid.link/12786727.O9o76ZdvQC@rafael.j.wysocki Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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 @@ -355,10 +355,13 @@ static int menu_select(struct cpuidle_dr /* * 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 <= data->next_timer_ns) { + s->target_residency_ns <= data->next_timer_ns && + s->exit_latency_ns <= predicted_ns) { predicted_ns = s->target_residency_ns; idx = i; break;