[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


  • To: Jason Andryuk <jason.andryuk@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 15 Jun 2026 21:22:28 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FecxwQS6kcbeT4bx3k9WML8Vxo1g1CpGIYKKV8HUbgM=; b=qdWnaBpNEDv+POC/WzF/Nyfv0G75/MovK93HOOKAI+NIn3xnPzrNheNqu8APmaDx8PPImIhrDV6QUxuvfhyeZ5Q9kywsVup+6gFuAjXmdIOX82aWzgAqOydUFMWghfUVMKnPKWs+yObXyq1PgUzKVg7QfEBOSH5yx/wC6MNb5ufVA5QTkV97hoSkCgOSnseoqqn2uMLaL1uPyTF5uU8bPHXVqDD6MC9TLIzQHHYUaG53Oi6DdnF/C49nerH+4ue8LIyOKGGnmN/zdvCWgQ3P9s2FRHG59wpUbAKZ3yjTkfy0Zc8jfeI1bm4jW1KjwVpeqsKMsM4HsLIXnYMhLQMmTg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=bUzV4oU2uLJH+tMvBJTA2VCId8L7vC1wEhHLzmQfXR/sWqYHTgra7ISS8CrbRpu31LpwKTDpYLYeaQgmuuUs68c3zUmn1AUHm2tATyJGWYBxWc6l344TKNtg5YDAdii10W+5f+Ql9mJdS/D+nA0faLMWGH/4eiayYRkmCXXCh6xFAMGO9swBBiFQpe6IpOhA4kNscK+iqqjV581NM1BkDwilGgEM3zO2S+dI35kPQoO57YBNwriAqtBBzyxZL5XiomWsYfEk14aVamsKO7OfFw3NvH+v+a6QC/PNRQksAXJplYzkigP4hQaPxO9gGEizYJVHobmuQD7V20wQvo3Llw==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Mon, 15 Jun 2026 19:22:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.