Re: [PATCH 12/15] tick/sched: Consolidate idle time fetching APIs

Frederic Weisbecker
2026-02-06T22:35:22Z

Le Fri, Feb 06, 2026 at 03:22:42PM +0100, Frederic Weisbecker a écrit :
> +static u64 get_cpu_sleep_time_us(int cpu, enum cpu_usage_stat idx,
> + bool compute_delta, u64 *last_update_time)
> +{
> + ktime_t now = ktime_get();
> + u64 res;
> +
> + if (vtime_generic_enabled_cpu(cpu))
> + res = kcpustat_field(idx, cpu);
> + else
> + res = kcpustat_field_dyntick(cpu, idx, compute_delta, now);
> +
> + do_div(res, NSEC_PER_USEC);
> +
> + if (last_update_time)
> + *last_update_time = res;

Urgh, this should be *last_update_time = ktime_to_us(now)

--
Frederic Weisbecker
SUSE Labs