qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <lvivier@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Thomas Huth <thuth@redhat.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 1/1] numa: equally distribute memory on nodes
Date: Wed, 3 May 2017 08:56:04 +0200	[thread overview]
Message-ID: <a3a0a0c8-6eb5-c3ac-2eec-8e7eecaf1d25@redhat.com> (raw)
In-Reply-To: <20170502200903.GE3482@thinpad.lan.raisama.net>

On 02/05/2017 22:09, Eduardo Habkost wrote:
> On Tue, May 02, 2017 at 06:29:55PM +0200, Laurent Vivier wrote:
> [...]
>> diff --git a/numa.c b/numa.c
>> index 6fc2393..750fd95 100644
>> --- a/numa.c
>> +++ b/numa.c
>> @@ -294,6 +294,42 @@ static void validate_numa_cpus(void)
>>      g_free(seen_cpus);
>>  }
>>  
>> +void numa_legacy_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
>> +                                 int nb_nodes, ram_addr_t size)
>> +{
>> +    int i;
>> +    uint64_t usedmem = 0;
>> +
>> +    /* Align each node according to the alignment
>> +     * requirements of the machine class
>> +     */
>> +
>> +    for (i = 0; i < nb_nodes - 1; i++) {
>> +        nodes[i].node_mem = (size / nb_nodes) &
>> +                            ~((1 << mc->numa_mem_align_shift) - 1);
>> +        usedmem += nodes[i].node_mem;
>> +    }
>> +    nodes[i].node_mem = size - usedmem;
>> +}
>> +
>> +void numa_default_auto_assign_ram(MachineClass *mc, NodeInfo *nodes,
>> +                                  int nb_nodes, ram_addr_t size)
>> +{
>> +    int i;
>> +    uint64_t usedmem = 0, node_mem;
>> +    uint64_t granularity = size / nb_nodes;
>> +    uint64_t propagate = 0;
>> +
>> +    for (i = 0; i < nb_nodes - 1; i++) {
>> +        node_mem = (granularity + propagate) &
>> +                   ~((1 << mc->numa_mem_align_shift) - 1);
>> +        propagate = granularity + propagate - node_mem;
>> +        nodes[i].node_mem = node_mem;
>> +        usedmem += node_mem;
>> +    }
>> +    nodes[i].node_mem = ram_size - usedmem;
> 
> I believe you meant 'size - usedmem' here.
> 
> I can fix this while applying the patch, if that's OK. The rest
> of the patch looks good to me.

Yes, you're right. You can fix this and apply.

Thanks,
Laurent

      reply	other threads:[~2017-05-03  6:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 16:29 [Qemu-devel] [PATCH v4 0/1] numa: equally distribute memory on nodes Laurent Vivier
2017-05-02 16:29 ` [Qemu-devel] [PATCH v4 1/1] " Laurent Vivier
2017-05-02 20:09   ` Eduardo Habkost
2017-05-03  6:56     ` Laurent Vivier [this message]

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=a3a0a0c8-6eb5-c3ac-2eec-8e7eecaf1d25@redhat.com \
    --to=lvivier@redhat.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=ehabkost@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=thuth@redhat.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).