From: Eduardo Habkost <ehabkost@redhat.com>
To: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
Hu Tao <hutao@cn.fujitsu.com>,
qemu-devel@nongnu.org, Anton Blanchard <anton@samba.org>,
David Rientjes <rientjes@google.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH v3] numa: enable sparse node numbering
Date: Mon, 30 Jun 2014 18:48:59 -0300 [thread overview]
Message-ID: <20140630214859.GP3222@otherpad.lan.raisama.net> (raw)
In-Reply-To: <20140630182610.GA15697@linux.vnet.ibm.com>
On Mon, Jun 30, 2014 at 11:26:10AM -0700, Nishanth Aravamudan wrote:
[...]
> > > - if (i == nb_numa_nodes) {
> > > + if (i == max_numa_node) {
> > > for (i = 0; i < max_cpus; i++) {
> > > - set_bit(i, numa_info[i % nb_numa_nodes].node_cpu);
> > > + do {
> > > + j = (j + 1) % max_numa_node;
> > > + } while (!numa_info[j].present);
> >
> > If you change it from "do { } while" to "while { }", you don't need to
> > initialize j to -1.
>
> I don't think that's quite as simple as you make it out to be. If you
> use a while() loop, we won't always increment j, which means once we've
> found a present node, we'll always use that node? j here basically
> represents the *last* used nodeid, which we don't want to use again when
> we re-enter the for-loop, we want to use the next present nodeid. It
> seems like the do {} while() does this fine? I could use a while() if I
> added another increment outside the loop, as follows:
>
> if (i == max_numa_nodeid) {
> for (i = 0, j = 0; i < max_cpus; i++) {
> while (!numa_info[j].present) {
> j = (j + 1) % (max_numa_nodeid);
> }
> set_bit(i, numa_info[j].node_cpu);
> j = (j + 1) % (max_numa_nodeid);
> }
> }
>
> If you think that is cleaner, I'll use that version.
You are right, and your "do { } while" version looks cleaner than
duplicating the "j = (j + 1) % (max_numa_nodeid)" line.
--
Eduardo
next prev parent reply other threads:[~2014-06-30 21:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 19:33 [Qemu-devel] [RFC PATCH] numa: enable sparse node numbering Nishanth Aravamudan
2014-06-24 0:48 ` [Qemu-devel] [RFC PATCH v2] " Nishanth Aravamudan
2014-06-24 1:08 ` [Qemu-devel] [RFC PATCH] ppc/spapr: support sparse NUMA " Nishanth Aravamudan
2014-06-24 3:34 ` Nishanth Aravamudan
2014-06-24 7:43 ` [Qemu-devel] [RFC PATCH v2] numa: enable sparse " Hu Tao
2014-06-24 17:40 ` [Qemu-devel] [RFC PATCH v3] " Nishanth Aravamudan
2014-06-25 11:21 ` Igor Mammedov
2014-06-25 16:13 ` Nishanth Aravamudan
2014-06-25 16:52 ` Eduardo Habkost
2014-06-25 17:04 ` Nishanth Aravamudan
2014-06-25 18:24 ` Michael S. Tsirkin
2014-06-26 6:29 ` Igor Mammedov
2014-06-25 18:23 ` Michael S. Tsirkin
2014-06-26 9:09 ` Hu Tao
2014-06-26 17:58 ` Nishanth Aravamudan
2014-06-26 18:39 ` Eduardo Habkost
2014-06-26 19:37 ` Eduardo Habkost
2014-06-30 18:26 ` Nishanth Aravamudan
2014-06-30 21:48 ` Eduardo Habkost [this message]
2014-06-24 7:33 ` [Qemu-devel] [RFC PATCH] " Igor Mammedov
2014-06-24 8:58 ` Alexey Kardashevskiy
2014-06-24 16:39 ` Nishanth Aravamudan
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=20140630214859.GP3222@otherpad.lan.raisama.net \
--to=ehabkost@redhat.com \
--cc=aik@ozlabs.ru \
--cc=anton@samba.org \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=nacc@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=rientjes@google.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.