From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A055526B755; Mon, 9 Mar 2026 09:13:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773047638; cv=none; b=ThAvak04qO7K4B+AZGh9dQFH61y8YaLWFwZjFbFwNLLwlkClTWdB1RCXzZMayhN+Jbv+a2YthNfJbvX33TgKuruMfuaFRdWXcd35E81Lei5zpQ4n70a6xRKaPssSiOEC8RXEPsZY2cGB8P5d/KQemrxss2foSPUGmMv67W+c6PQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773047638; c=relaxed/simple; bh=mA/1kkvPSdKHdp2QV4yLOnxFW5xvMK+WX3Kw3SkhUW0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=klc+qcDKse09SMi9fRSR6VJSKedeWqwCNiKiCAxR6rjIsstgAWJMwxsKx5TLSgkdOXHRiC8ZaEBsqYsFWaLuHm0ushTK+5TMl7Te3pppKeL/By/vGrMUm4NnwTa/KiqULCvptt1Tu9SQP8Gl9LT2tdxIt1NaTs/n3e0zlb0UxNY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CD0031570; Mon, 9 Mar 2026 02:13:49 -0700 (PDT) Received: from [10.1.25.22] (e127648.arm.com [10.1.25.22]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F1CA93F5CA; Mon, 9 Mar 2026 02:13:53 -0700 (PDT) Message-ID: Date: Mon, 9 Mar 2026 09:13:52 +0000 Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] sched: idle: Make skipping governor callbacks more consistent To: "Rafael J. Wysocki" , Linux PM Cc: Qais Yousef , Thomas Gleixner , LKML , Peter Zijlstra , Frederic Weisbecker , Aboorva Devarajan References: <20260301191959.406218221@kernel.org> <20260304030306.uk5c63xw4oqvjffb@airbuntu> <12857700.O9o76ZdvQC@rafael.j.wysocki> Content-Language: en-US From: Christian Loehle In-Reply-To: <12857700.O9o76ZdvQC@rafael.j.wysocki> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/7/26 16:12, Rafael J. Wysocki wrote: > 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 available") > Signed-off-by: Rafael J. Wysocki > --- > 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 <= 1) { > - *stop_tick = false; > - return 0; > - } > - > return cpuidle_curr_governor->select(drv, dev, stop_tick); > } > > --- a/kernel/sched/idle.c > +++ b/kernel/sched/idle.c > @@ -221,7 +221,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; > > /* > @@ -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); > } > > exit_idle: > > > Duh, good catch. Reviewed-by: Christian Loehle