LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Glauber Costa <glommer@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Rik van Riel <riel@redhat.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>,
	Avi Kivity <avi@redhat.com>,
	Venkatesh Pallipadi <venki@google.com>
Subject: Re: [PATCH v3 5/6] KVM-GST: adjust scheduler cpu power
Date: Fri, 11 Feb 2011 20:05:45 +0100	[thread overview]
Message-ID: <1297451145.5226.88.camel@laptop> (raw)
In-Reply-To: <1297448364-14051-6-git-send-email-glommer@redhat.com>

On Fri, 2011-02-11 at 13:19 -0500, Glauber Costa wrote:

>  static void update_rq_clock_task(struct rq *rq, s64 delta)
>  {
> +	s64 irq_delta = 0, steal = 0;
>  
> +#ifdef CONFIG_IRQ_TIME_ACCOUNTING
>  	irq_delta = irq_time_read(cpu_of(rq)) - rq->prev_irq_time;
>  
>  	/*
> @@ -1926,20 +1932,24 @@ static void update_rq_clock_task(struct rq *rq, s64 delta)
>  
>  	rq->prev_irq_time += irq_delta;
>  	delta -= irq_delta;
> +#endif
> +#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
>  
> +	steal = steal_time_clock(cpu_of(rq)) - rq->prev_steal_time;
>  
> +	if (steal > delta)
> +		steal = delta;
> +
> +	rq->prev_steal_time += steal;
> +
> +	delta -= steal;
> +#endif
>  
>  	rq->clock_task += delta;
>  
> +	if ((irq_delta + steal) && sched_feat(NONTASK_POWER))
> +		sched_rt_avg_update(rq, irq_delta + steal);
> +}

I think we should make both these conditional, like:

#ifdef CONFIG_IRQ_TIME_ACCOUNTING
  if (sched_clock_irqtime) {
    /* ... magic ... */
  }
#endif

#ifdef CONFIG_PARAVIRT_TIME_ACCOUNTING
  if (sched_paravirt_time) {
    /* ... magic ... */
  }
#endif


Once the jump-label stuff gets a bit better we could use the if
(static_branch()) magic to avoid pretty much all cost.


  reply	other threads:[~2011-02-11 19:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 18:19 [PATCH v3 0/6] Steal time for KVM Glauber Costa
2011-02-11 18:19 ` [PATCH v3 1/6] KVM-HDR: KVM Steal time implementation Glauber Costa
2011-02-15 14:25   ` Avi Kivity
2011-02-11 18:19 ` [PATCH v3 2/6] KVM-HV: " Glauber Costa
2011-02-15 14:34   ` Avi Kivity
2011-02-11 18:19 ` [PATCH v3 3/6] KVM-GST: KVM Steal time accounting Glauber Costa
2011-02-11 19:05   ` Peter Zijlstra
2011-02-12 23:46     ` Glauber Costa
2011-02-15 14:35   ` Avi Kivity
2011-02-15 14:45     ` Peter Zijlstra
2011-02-15 15:17       ` Avi Kivity
2011-02-15 15:24         ` Rik van Riel
2011-02-15 15:26           ` Avi Kivity
2011-02-15 15:27         ` Peter Zijlstra
2011-02-11 18:19 ` [PATCH v3 4/6] KVM-GST: KVM Steal time registration Glauber Costa
2011-02-15 14:41   ` Avi Kivity
2011-02-15 15:48     ` Peter Zijlstra
2011-02-11 18:19 ` [PATCH v3 5/6] KVM-GST: adjust scheduler cpu power Glauber Costa
2011-02-11 19:05   ` Peter Zijlstra [this message]
2011-02-11 18:19 ` [PATCH v3 6/6] Describe KVM_MSR_STEAL_TIME Glauber Costa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297451145.5226.88.camel@laptop \
    --to=peterz@infradead.org \
    --cc=avi@redhat.com \
    --cc=glommer@redhat.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=venki@google.com \
    --subject='Re: [PATCH v3 5/6] KVM-GST: adjust scheduler cpu power' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).