From nobody Thu Apr 9 15:10:26 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 5B3F5314A9E; Sat, 7 Mar 2026 16:12:10 +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=1772899930; cv=none; b=F1gIi/brCA2YueVjggFI5syDdlaQPq1adOy09AN+HEQXm9c0AgyqXa71AIq9cKQMJ+wvWxwo+slgLUASgEt9+fysTI5OHSN9be/r5J/1b/oMXe4BQhGsjLwaNkyvAuhorxKjVCR4u0ulLaPZCA7UTJEsr6BA90sNY5QUmHYx7zE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772899930; c=relaxed/simple; bh=COcBWYVQ3me1XrZcYzsiT/MjFffyneHpAQ+6AOpHX7g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oqiWIP4QVVxkpD7FjrYaMdVDm6NmHqBMrBY7WOYtcYut3Zy1u2nBjtx8RtcuXRpIaWJ+L/8ynGgWEaP2wI1qF/4B1q7KYKZ7upt9bBq4NLue+3OdZFpVn9Tc3tDUxbKdZL/JnDPyyUIoCl6jzi2dsZLDhTqP1LElW2jpFX/ZqPE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=QCKAQkS/; 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="QCKAQkS/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE2BBC19422; Sat, 7 Mar 2026 16:12:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772899929; bh=COcBWYVQ3me1XrZcYzsiT/MjFffyneHpAQ+6AOpHX7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QCKAQkS/OCKSBf8kTCBwM54F6cAAXbj33WhocOM8luROR+fmgNF/nQXWEy4rZlir9 X7EJBpdG13OAe3qplmuLPh61CDLXIR6QKhcdwdFgxh9yOVxTD1+fd77huLfqLDyEzh mWOw8Y5J67RCg/QJ4xwnp0eXHqc0SrGVT+phggC6GE+N9FRN2mh8SnPpxkas/tIdA6 fjse1+HeeDz6z9keSkMiHkVhCjGWxRisKtNvoJdN0ed555TaJE59qoeN7Xrw1AJKvg L+aSdzQu1AZukyYeCK2BQq1Swcxi4PJ+IaGKwuZkp7tDz7xegogfeMmhT81cMwqIRv V0h73MdJOY5og== From: "Rafael J. Wysocki" To: Linux PM Cc: Qais Yousef , Christian Loehle , Thomas Gleixner , LKML , Peter Zijlstra , Frederic Weisbecker , Aboorva Devarajan Subject: [PATCH v1] sched: idle: Make skipping governor callbacks more consistent Date: Sat, 07 Mar 2026 17:12:05 +0100 Message-ID: <12857700.O9o76ZdvQC@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <20260304030306.uk5c63xw4oqvjffb@airbuntu> References: <20260301191959.406218221@kernel.org> <20260304030306.uk5c63xw4oqvjffb@airbuntu> 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 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 av= ailable") Signed-off-by: Rafael J. Wysocki Reviewed-by: Aboorva Devarajan Reviewed-by: Christian Loehle Reviewed-by: Frederic Weisbecker --- drivers/cpuidle/cpuidle.c | 10 ---------- kernel/sched/idle.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 11 deletions(-) --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -359,16 +359,6 @@ noinstr int cpuidle_enter_state(struct c 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 <=3D 1) { - *stop_tick =3D false; - return 0; - } - return cpuidle_curr_governor->select(drv, dev, stop_tick); } =20 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -221,7 +221,7 @@ static void cpuidle_idle_call(void) =20 next_state =3D 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 =3D true; =20 /* @@ -239,6 +239,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); } =20 exit_idle: