From: Dario Faggioli <dario.faggioli@citrix.com>
To: "xumengpanda@gmail.com" <xumengpanda@gmail.com>
Cc: "Keir (Xen.org)" <keir@xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
"JBeulich@suse.com" <JBeulich@suse.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH 7/7] xen: sched_rt: print useful affinity info when dumping
Date: Tue, 17 Mar 2015 14:12:10 +0000 [thread overview]
Message-ID: <1426601529.32500.94.camel@citrix.com> (raw)
In-Reply-To: <CAENZ-+nPXvpNwwcZhKzP-BaW42TissgjbUKKawCtV9YD79qRww@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3017 bytes --]
On Mon, 2015-03-16 at 16:30 -0400, Meng Xu wrote:
> Hi Dario,
>
Hey,
> 2015-03-16 13:05 GMT-04:00 Dario Faggioli <dario.faggioli@citrix.com>:
> >
> > This change also takes the chance to add a scratch
> > cpumask, to avoid having to create one more
> > cpumask_var_t on the stack of the dumping routine.
>
> Actually, I have a question about the strength of this design. When we
> have a machine with many cpus, we will end up with allocating a
> cpumask for each cpu.
>
Just FTR, what we will end up allocating is:
- an array of *pointers* to cpumasks with as many elements as the
number of pCPUs,
- a cpumask *only* for the pCPUs subjected to an instance of the RTDS
scheduler.
So, for instance, if you have 64 pCPUs, but are using the RTDS scheduler
only in a cpupool with 2 pCPUs, you'll have an array of 64 pointers to
cpumask_t, but only 2 actual cpumasks.
> Is this better than having a cpumask_var_t on
> the stack of the dumping routine, since the dumping routine is not in
> the hot path?
>
George and Jan replied to this already, I think. Allow me to add just a
few words:
> > Such scratch area can be used to kill most of the
> > cpumasks_var_t local variables in other functions
> > in the file, but that is *NOT* done in this chage.
> >
This is the point, actually! As said here, this is not only for the sake
of the dumping routine. In fact, ideally, someone will, in the near
future, go throughout the whole file and kill most of the cpumask_t
local variables, and most of the cpumask dynamic allocations, in favour
of using this scratch area.
> > @@ -409,6 +423,10 @@ rt_init(struct scheduler *ops)
> > if ( prv == NULL )
> > return -ENOMEM;
> >
> > + _cpumask_scratch = xmalloc_array(cpumask_var_t, nr_cpu_ids);
>
> Is it better to use xzalloc_array?
>
Why? IMO, not really. I'm only free()-ing (in rt_free_pdata()) the
elements of the array that have been previously successfully allocated
(in rt_alloc_pdata()), so I don't think there is any special requirement
for all the elements to be NULL right away.
> > + if ( _cpumask_scratch == NULL )
> > + return -ENOMEM;
> > +
> > spin_lock_init(&prv->lock);
> > INIT_LIST_HEAD(&prv->sdom);
> > INIT_LIST_HEAD(&prv->runq);
> > @@ -426,6 +444,7 @@ rt_deinit(const struct scheduler *ops)
> > {
> > struct rt_private *prv = rt_priv(ops);
> >
> > + xfree(_cpumask_scratch);
> > xfree(prv);
> > }
> >
> > @@ -443,6 +462,9 @@ rt_alloc_pdata(const struct scheduler *ops, int cpu)
> > per_cpu(schedule_data, cpu).schedule_lock = &prv->lock;
> > spin_unlock_irqrestore(&prv->lock, flags);
> >
> > + if ( !alloc_cpumask_var(&_cpumask_scratch[cpu]) )
>
> Is it better to use zalloc_cpumask_var() here?
>
Nope. It's a scratch area, after all, so one really should not assume it
to be in a specific state (e.g., no bits set as you're suggesting) when
using it.
Thanks and Regards,
Dario
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-03-17 14:12 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 17:04 [PATCH 0/7] Improving dumping of scheduler related info Dario Faggioli
2015-03-16 17:04 ` [PATCH 1/7] xen: sched_rt: avoid ASSERT()ing on runq dump if there are no domains Dario Faggioli
2015-03-16 18:18 ` George Dunlap
2015-03-16 20:31 ` Meng Xu
2015-03-17 10:41 ` Jan Beulich
2015-03-17 11:00 ` Dario Faggioli
2015-03-16 17:04 ` [PATCH 2/7] xen: sched_rt: implement the .free_pdata hook Dario Faggioli
2015-03-16 17:10 ` Dario Faggioli
2015-03-16 18:23 ` Meng Xu
2015-03-17 13:00 ` Dario Faggioli
2015-03-16 18:17 ` Meng Xu
2015-03-16 18:21 ` George Dunlap
2015-03-16 17:05 ` [PATCH 3/7] xen: rework locking for dump of scheduler info (debug-key r) Dario Faggioli
2015-03-16 18:41 ` George Dunlap
2015-03-16 20:04 ` Meng Xu
2015-03-17 10:54 ` Jan Beulich
2015-03-17 11:05 ` George Dunlap
2015-03-17 11:18 ` Dario Faggioli
2015-03-17 11:25 ` Jan Beulich
2015-03-17 11:32 ` George Dunlap
2015-03-17 11:43 ` Jan Beulich
2015-03-17 12:01 ` George Dunlap
2015-03-17 11:14 ` Dario Faggioli
2015-03-17 11:31 ` Jan Beulich
2015-03-16 17:05 ` [PATCH 4/7] xen: print online pCPUs and free pCPUs when dumping scheduler info Dario Faggioli
2015-03-16 18:37 ` Juergen Gross
2015-03-16 18:46 ` George Dunlap
2015-03-17 10:59 ` Jan Beulich
2015-03-16 17:05 ` [PATCH 5/7] xen: make dumping vcpu info look better Dario Faggioli
2015-03-16 18:48 ` George Dunlap
2015-03-16 20:06 ` Meng Xu
2015-03-16 17:05 ` [PATCH 6/7] xen: sched_credit2: more info when dumping Dario Faggioli
2015-03-16 18:50 ` George Dunlap
2015-03-16 17:05 ` [PATCH 7/7] xen: sched_rt: print useful affinity " Dario Faggioli
2015-03-16 19:05 ` George Dunlap
2015-03-17 13:51 ` Dario Faggioli
2015-03-16 20:30 ` Meng Xu
2015-03-17 11:10 ` George Dunlap
2015-03-17 11:28 ` Jan Beulich
2015-03-18 1:05 ` Meng Xu
2015-03-17 14:12 ` Dario Faggioli [this message]
2015-03-18 1:07 ` Meng Xu
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=1426601529.32500.94.camel@citrix.com \
--to=dario.faggioli@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xen.org \
--cc=xumengpanda@gmail.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 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.