xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Dario Faggioli <dario.faggioli@citrix.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"Keir (Xen.org)" <keir@xen.org>,
	Ian Campbell <Ian.Campbell@citrix.com>
Subject: Re: [PATCH 3 of 6 v2] xen: sched_credit: use current_on_cpu() when appropriate
Date: Fri, 14 Dec 2012 19:39:20 +0000	[thread overview]
Message-ID: <50CB8068.7080404@eu.citrix.com> (raw)
In-Reply-To: <21b142498d4699921251.1355280773@Solace>

On 12/12/12 02:52, Dario Faggioli wrote:
> Defined by the previous change, using it wherever it is appropriate
> throughout sched_credit.c makes the code easier to read.

Hmm, I hadn't read this patch when I commented about removing the macro 
from the first patch. :-)

I personally think that using vc->processor is better in that patch 
anyway; but using this macro elsewhere is probably fine.

I think from a taste point of view, I would have put this patch, with 
the new definition, as the first patch in the series, and the had the 
second patch just use it.

I'll go back and respond to Jan's comment about the macro.

  -George

>
> Signed-off-by: Dario Faggioli <dario.faggioli@citrix.com>
>
> diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
> --- a/xen/common/sched_credit.c
> +++ b/xen/common/sched_credit.c
> @@ -231,7 +231,7 @@ static void burn_credits(struct csched_v
>       unsigned int credits;
>   
>       /* Assert svc is current */
> -    ASSERT(svc==CSCHED_VCPU(per_cpu(schedule_data, svc->vcpu->processor).curr));
> +    ASSERT( svc == CSCHED_VCPU(current_on_cpu(svc->vcpu->processor)) );
>   
>       if ( (delta = now - svc->start_time) <= 0 )
>           return;
> @@ -249,8 +249,7 @@ DEFINE_PER_CPU(unsigned int, last_tickle
>   static inline void
>   __runq_tickle(unsigned int cpu, struct csched_vcpu *new)
>   {
> -    struct csched_vcpu * const cur =
> -        CSCHED_VCPU(per_cpu(schedule_data, cpu).curr);
> +    struct csched_vcpu * const cur = CSCHED_VCPU(current_on_cpu(cpu));
>       struct csched_private *prv = CSCHED_PRIV(per_cpu(scheduler, cpu));
>       cpumask_t mask, idle_mask;
>       int idlers_empty;
> @@ -387,7 +386,7 @@ csched_alloc_pdata(const struct schedule
>           per_cpu(schedule_data, cpu).sched_priv = spc;
>   
>       /* Start off idling... */
> -    BUG_ON(!is_idle_vcpu(per_cpu(schedule_data, cpu).curr));
> +    BUG_ON(!is_idle_vcpu(current_on_cpu(cpu)));
>       cpumask_set_cpu(cpu, prv->idlers);
>   
>       spin_unlock_irqrestore(&prv->lock, flags);
> @@ -730,7 +729,7 @@ csched_vcpu_sleep(const struct scheduler
>   
>       BUG_ON( is_idle_vcpu(vc) );
>   
> -    if ( per_cpu(schedule_data, vc->processor).curr == vc )
> +    if ( current_on_cpu(vc->processor) == vc )
>           cpu_raise_softirq(vc->processor, SCHEDULE_SOFTIRQ);
>       else if ( __vcpu_on_runq(svc) )
>           __runq_remove(svc);
> @@ -744,7 +743,7 @@ csched_vcpu_wake(const struct scheduler
>   
>       BUG_ON( is_idle_vcpu(vc) );
>   
> -    if ( unlikely(per_cpu(schedule_data, cpu).curr == vc) )
> +    if ( unlikely(current_on_cpu(cpu) == vc) )
>       {
>           SCHED_STAT_CRANK(vcpu_wake_running);
>           return;
> @@ -1213,7 +1212,7 @@ static struct csched_vcpu *
>   csched_runq_steal(int peer_cpu, int cpu, int pri)
>   {
>       const struct csched_pcpu * const peer_pcpu = CSCHED_PCPU(peer_cpu);
> -    const struct vcpu * const peer_vcpu = per_cpu(schedule_data, peer_cpu).curr;
> +    const struct vcpu * const peer_vcpu = current_on_cpu(peer_cpu);
>       struct csched_vcpu *speer;
>       struct list_head *iter;
>       struct vcpu *vc;
> @@ -1502,7 +1501,7 @@ csched_dump_pcpu(const struct scheduler
>       printk("core=%s\n", cpustr);
>   
>       /* current VCPU */
> -    svc = CSCHED_VCPU(per_cpu(schedule_data, cpu).curr);
> +    svc = CSCHED_VCPU(current_on_cpu(cpu));
>       if ( svc )
>       {
>           printk("\trun: ");

  reply	other threads:[~2012-12-14 19:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12  2:52 [PATCH 0 of 6 v2] xen: sched_credit: fix picking & tickling and also add some tracing Dario Faggioli
2012-12-12  2:52 ` [PATCH 1 of 6 v2] xen: sched_credit: improve picking up the idlal CPU for a VCPU Dario Faggioli
2012-12-12 10:04   ` Jan Beulich
2012-12-12 10:19     ` Dario Faggioli
2012-12-12 10:30       ` Jan Beulich
2012-12-12 10:38         ` Dario Faggioli
2012-12-14 19:50     ` George Dunlap
2012-12-17  8:35       ` Jan Beulich
2012-12-17 14:36         ` Dario Faggioli
2012-12-14 19:16   ` George Dunlap
2012-12-12  2:52 ` [PATCH 2 of 6 v2] xen: sched_credit: improve tickling of idle CPUs Dario Faggioli
2012-12-14 19:29   ` George Dunlap
2012-12-12  2:52 ` [PATCH 3 of 6 v2] xen: sched_credit: use current_on_cpu() when appropriate Dario Faggioli
2012-12-14 19:39   ` George Dunlap [this message]
2012-12-17 14:41     ` Dario Faggioli
2012-12-12  2:52 ` [PATCH 4 of 6 v2] xen: tracing: report where a VCPU wakes up Dario Faggioli
2012-12-14 19:57   ` George Dunlap
2012-12-17 14:43     ` Dario Faggioli
2012-12-12  2:52 ` [PATCH 5 of 6 v2] xen: tracing: introduce per-scheduler trace event IDs Dario Faggioli
2012-12-14 20:00   ` George Dunlap
2012-12-12  2:52 ` [PATCH 6 of 6 v2] xen: sched_credit: add some tracing Dario Faggioli
2012-12-14 20:05   ` George Dunlap
2012-12-17 14:45     ` Dario Faggioli

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=50CB8068.7080404@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=dario.faggioli@citrix.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xensource.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).