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 B66AC3AF66E; Mon, 23 Mar 2026 14:16:02 +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=1774275362; cv=none; b=KeEkK8UeHnFg2sLtVYxEu25UgR2LeGr+IIld4S3PY9gFD0GYj1avfVoZJPMZrszxjtTQEmGaqAhs+k8wUYsAe/8flrS7KPuqznYZKwWPvfeICUcCI+efGx4Ra+28afnEQKkjTSVt2yAOqq1FT2NbRDrbHhQ4xIfPdZTo2+srOvM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774275362; c=relaxed/simple; bh=R+RaEVm9FvRnn07NzP/7aUO1aFa4KlXtLpScAcJWQpc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fSgFElNSmVL8AjsrmFsDUYx/NvxSjUHV31MTzNHcEdlBvsq7Pr27+OBILbT1aD+QjcHnFxR66FENzQxfkGt9pwDs8WsAd9diAWNULJniZukzdKuNvksbofl9J3U8vpLZl3pHiTiUWJ6QXIVtUKTwn1uGP8shlFmUxu39K52VAac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=hVRtt7SG; 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="hVRtt7SG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 408BFC4CEF7; Mon, 23 Mar 2026 14:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774275362; bh=R+RaEVm9FvRnn07NzP/7aUO1aFa4KlXtLpScAcJWQpc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hVRtt7SGJwG3599kK/lr6VtANCYYz0Q/ZiElp4/ZeA73bwZPWORTwBAFRJFECjoI+ ln/EDznjtGGPqgta+5fv8PHD7+BmvvKOFlclmAgMkUPmiBbA2gsnSLY4NrTuEUWVmV mB03BxfZrYsBTJnjuudfXDE7Jul3cxfs93lfimzs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Rafael J. Wysocki" , Christian Loehle , Aboorva Devarajan , Frederic Weisbecker , Sasha Levin Subject: [PATCH 6.12 071/460] sched: idle: Make skipping governor callbacks more consistent Date: Mon, 23 Mar 2026 14:41:07 +0100 Message-ID: <20260323134528.439654902@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134526.647552166@linuxfoundation.org> References: <20260323134526.647552166@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rafael J. Wysocki [ Upstream commit d557640e4ce589a24dca5ca7ce3b9680f471325f ] If the cpuidle governor .select() callback is skipped because there is only one idle state in the cpuidle driver, the .reflect() callback should be skipped as well, at least for consistency (if not for correctness), so do it. Fixes: e5c9ffc6ae1b ("cpuidle: Skip governor when only one idle state is available") Signed-off-by: Rafael J. Wysocki Reviewed-by: Christian Loehle Reviewed-by: Aboorva Devarajan Reviewed-by: Frederic Weisbecker Link: https://patch.msgid.link/12857700.O9o76ZdvQC@rafael.j.wysocki Signed-off-by: Sasha Levin --- drivers/cpuidle/cpuidle.c | 10 ---------- kernel/sched/idle.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 2cb11e5a11251..0e1bbc966135d 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -353,16 +353,6 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev, int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, bool *stop_tick) { - /* - * If there is only a single idle state (or none), there is nothing - * meaningful for the governor to choose. Skip the governor and - * always use state 0 with the tick running. - */ - if (drv->state_count <= 1) { - *stop_tick = false; - return 0; - } - return cpuidle_curr_governor->select(drv, dev, stop_tick); } diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index 624ef809f6715..b6a072a323a44 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -214,7 +214,7 @@ static void cpuidle_idle_call(void) next_state = cpuidle_find_deepest_state(drv, dev, max_latency_ns); call_cpuidle(drv, dev, next_state); - } else { + } else if (drv->state_count > 1) { bool stop_tick = true; /* @@ -232,6 +232,15 @@ static void cpuidle_idle_call(void) * Give the governor an opportunity to reflect on the outcome */ cpuidle_reflect(dev, entered_state); + } else { + tick_nohz_idle_retain_tick(); + + /* + * If there is only a single idle state (or none), there is + * nothing meaningful for the governor to choose. Skip the + * governor and always use state 0. + */ + call_cpuidle(drv, dev, 0); } exit_idle: -- 2.51.0