|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/2] xen/cpufreq: fix usages of align_timer() in the on-demand governor
On Mon, Jun 15, 2026 at 01:44:54PM -0400, Jason Andryuk wrote:
> On 2026-02-27 02:32, Roger Pau Monne wrote:
> > The first parameter passed to align_timer() is the timer expiration, not
> > the current time. Adjust the calls to align_timer() in the on-demand
> > governor to pass the expected timer expiration as the first parameter.
>
> Internally, we have a report of a benchmark regressing ~6% with this change
> on 4.20.
>
> s_time_t align_timer(s_time_t firsttick, uint64_t period)
> {
> if ( !period )
> return firsttick;
>
> return firsttick + (period - 1) - ((firsttick - 1) % period);
> }
>
> The code rounds firsttick up to the next period:
>
> align_timer(0, period) -> 0
> align_timer(1, period) -> period
> align_timer(period - 1, period) -> period
> align_timer(period, period) -> period
> align_timer(period + 1, period) -> 2 * period
>
> With the change of this patch adding the period before calling
> align_timer(), the timer is set for two periods in the future. The only
> exception is when firsttick % period == 0. I think that is unlikely to
> happen since NOW() will always be a little after the period. Even if it did
> happen, the timer would fire immediately, but the next timer would be set
> for 1 period later.
>
> So I think we want to revert?
Forgot to mention in the first reply, as I went straight into the
technical side: thanks for finding and reporting this, we can
hopefully get it sorted before the release.
Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |