lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iWLSSvyei_-KdNZs6iWCgy9f1LpVYcaPSW7ZOig-3=yw@mail.gmail.com>
Date: Wed, 9 Apr 2025 19:38:42 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Zhongqiu Han <quic_zhonhan@...cinc.com>
Cc: rafael@...nel.org, daniel.lezcano@...aro.org, christian.loehle@....com, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] cpuidle: menu: Optimize bucket assignment when
 next_timer_ns equals KTIME_MAX

On Sat, Apr 5, 2025 at 3:53 PM Zhongqiu Han <quic_zhonhan@...cinc.com> wrote:
>
> Directly assign the last bucket value instead of calling which_bucket()
> when next_timer_ns equals KTIME_MAX, the largest possible value that
> always falls into the last bucket. This avoids unnecessary calculations
> and enhances performance.
>
> Reviewed-by: Christian Loehle <christian.loehle@....com>
> Signed-off-by: Zhongqiu Han <quic_zhonhan@...cinc.com>
> ---
> v1 -> v2:
> - Rebased on top of current next.
> - Following Christian's review suggestions, remove unnecessary code comments.
> - Link to v1: https://lore.kernel.org/all/20250403092852.1072015-1-quic_zhonhan@quicinc.com/
>
>  drivers/cpuidle/governors/menu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
> index 39aa0aea61c6..52d5d26fc7c6 100644
> --- a/drivers/cpuidle/governors/menu.c
> +++ b/drivers/cpuidle/governors/menu.c
> @@ -255,7 +255,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
>                  */
>                 data->next_timer_ns = KTIME_MAX;
>                 delta_tick = TICK_NSEC / 2;
> -               data->bucket = which_bucket(KTIME_MAX);
> +               data->bucket = BUCKETS - 1;
>         }
>
>         if (unlikely(drv->state_count <= 1 || latency_req == 0) ||
> --

Applied as 6.16 material, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ