All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dario Faggioli <dfaggioli@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Subject: Re: [PATCH 1/2] xen: credit2: avoid using cpumask_weight() in hot-paths
Date: Fri, 26 Apr 2019 15:01:15 +0200	[thread overview]
Message-ID: <49b2fb80a576cff4b26ae09668cc8b5b243a9f9a.camel@suse.com> (raw)
In-Reply-To: <c7f0e1c1-f69f-3c53-7147-21e24d4618b1@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1732 bytes --]

On Tue, 2019-04-23 at 10:44 +0100, Andrew Cooper wrote:
> On 20/04/2019 16:24, Dario Faggioli wrote:
>
> Definitely +1 to algorithm changes which avoid its use entirely.
> 
> A few cosmetic observations.
> 
Ok...

> > diff --git a/xen/common/sched_credit2.c
> > b/xen/common/sched_credit2.c
> > index 6958b265fc..7034325243 100644
> > --- a/xen/common/sched_credit2.c
> > +++ b/xen/common/sched_credit2.c
> > @@ -466,6 +466,7 @@ struct csched2_runqueue_data {
> >      spinlock_t lock;           /* Lock for this
> > runqueue                     */
> >  
> >      struct list_head runq;     /* Ordered list of runnable
> > vms               */
> > +    int nr_cpus;               /* How many CPUs are sharing this
> > runqueue    */
> 
> Unsigned int.
> 
Yep.

> > @@ -3944,8 +3951,12 @@ csched2_deinit_pdata(const struct scheduler
> > *ops, void *pcpu, int cpu)
> >      __cpumask_clear_cpu(cpu, &rqd->smt_idle);
> >      __cpumask_clear_cpu(cpu, &rqd->active);
> >  
> > -    if ( cpumask_empty(&rqd->active) )
> > +    rqd->nr_cpus--;
> > +    ASSERT(cpumask_weight(&rqd->active) == rqd->nr_cpus);
> > +
> > +    if ( rqd->nr_cpus == 0 )
> >      {
> > +	ASSERT(cpumask_empty(&rqd->active));
> 
> And here.
> 
Right. Not sure how they ended in there. Will remove them.

> Is it really worth having both asserts?  The second is redundant.
> 
I think I agree. I'll keep the first one only.

Thanks and Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

WARNING: multiple messages have this Message-ID (diff)
From: Dario Faggioli <dfaggioli@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org
Cc: George Dunlap <george.dunlap@eu.citrix.com>
Subject: Re: [Xen-devel] [PATCH 1/2] xen: credit2: avoid using cpumask_weight() in hot-paths
Date: Fri, 26 Apr 2019 15:01:15 +0200	[thread overview]
Message-ID: <49b2fb80a576cff4b26ae09668cc8b5b243a9f9a.camel@suse.com> (raw)
Message-ID: <20190426130115.jKP46pnAXxSXtof-pAmAq1iATcFRwnYVSqDn-_tNUWM@z> (raw)
In-Reply-To: <c7f0e1c1-f69f-3c53-7147-21e24d4618b1@citrix.com>


[-- Attachment #1.1: Type: text/plain, Size: 1732 bytes --]

On Tue, 2019-04-23 at 10:44 +0100, Andrew Cooper wrote:
> On 20/04/2019 16:24, Dario Faggioli wrote:
>
> Definitely +1 to algorithm changes which avoid its use entirely.
> 
> A few cosmetic observations.
> 
Ok...

> > diff --git a/xen/common/sched_credit2.c
> > b/xen/common/sched_credit2.c
> > index 6958b265fc..7034325243 100644
> > --- a/xen/common/sched_credit2.c
> > +++ b/xen/common/sched_credit2.c
> > @@ -466,6 +466,7 @@ struct csched2_runqueue_data {
> >      spinlock_t lock;           /* Lock for this
> > runqueue                     */
> >  
> >      struct list_head runq;     /* Ordered list of runnable
> > vms               */
> > +    int nr_cpus;               /* How many CPUs are sharing this
> > runqueue    */
> 
> Unsigned int.
> 
Yep.

> > @@ -3944,8 +3951,12 @@ csched2_deinit_pdata(const struct scheduler
> > *ops, void *pcpu, int cpu)
> >      __cpumask_clear_cpu(cpu, &rqd->smt_idle);
> >      __cpumask_clear_cpu(cpu, &rqd->active);
> >  
> > -    if ( cpumask_empty(&rqd->active) )
> > +    rqd->nr_cpus--;
> > +    ASSERT(cpumask_weight(&rqd->active) == rqd->nr_cpus);
> > +
> > +    if ( rqd->nr_cpus == 0 )
> >      {
> > +	ASSERT(cpumask_empty(&rqd->active));
> 
> And here.
> 
Right. Not sure how they ended in there. Will remove them.

> Is it really worth having both asserts?  The second is redundant.
> 
I think I agree. I'll keep the first one only.

Thanks and Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-04-26 13:01 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 15:24 [PATCH 0/2] xen: sched/Credit2: small and trivial improvements Dario Faggioli
2019-04-20 15:24 ` [Xen-devel] " Dario Faggioli
2019-04-20 15:24 ` [PATCH 1/2] xen: credit2: avoid using cpumask_weight() in hot-paths Dario Faggioli
2019-04-20 15:24   ` [Xen-devel] " Dario Faggioli
2019-04-23  9:44   ` Andrew Cooper
2019-04-23  9:44     ` [Xen-devel] " Andrew Cooper
2019-04-26 13:01     ` Dario Faggioli [this message]
2019-04-26 13:01       ` Dario Faggioli
2019-04-23  9:48   ` Andrii Anisov
2019-04-23  9:48     ` [Xen-devel] " Andrii Anisov
2019-04-20 15:24 ` [PATCH 2/2] xen: sched: we never get into context_switch() with prev==next Dario Faggioli
2019-04-20 15:24   ` [Xen-devel] " Dario Faggioli
2019-04-21 17:08   ` Julien Grall
2019-04-21 17:08     ` [Xen-devel] " Julien Grall
2019-04-23  9:13   ` Andrii Anisov
2019-04-23  9:13     ` [Xen-devel] " Andrii Anisov
2019-04-23  9:47     ` Andrew Cooper
2019-04-23  9:47       ` [Xen-devel] " Andrew Cooper
2019-04-23 10:33       ` Andrii Anisov
2019-04-23 10:33         ` [Xen-devel] " Andrii Anisov
2019-04-26 15:13     ` Dario Faggioli
2019-04-26 15:13       ` [Xen-devel] " Dario Faggioli
2019-04-26 16:22       ` Julien Grall
2019-04-26 16:22         ` [Xen-devel] " Julien Grall
2019-04-26 16:26         ` Andrew Cooper
2019-04-26 16:26           ` [Xen-devel] " Andrew Cooper
2019-05-08 10:03       ` Andrii Anisov
2019-05-08 10:03         ` [Xen-devel] " Andrii Anisov
2019-04-23  9:50   ` George Dunlap
2019-04-23  9:50     ` [Xen-devel] " George Dunlap
2019-04-23  9:56     ` Juergen Gross
2019-04-23  9:56       ` [Xen-devel] " Juergen Gross
2019-04-26 12:58       ` Dario Faggioli
2019-04-26 12:58         ` [Xen-devel] " Dario Faggioli
2019-04-23 10:00   ` Andrew Cooper
2019-04-23 10:00     ` [Xen-devel] " Andrew Cooper

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=49b2fb80a576cff4b26ae09668cc8b5b243a9f9a.camel@suse.com \
    --to=dfaggioli@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.