From: Paolo Bonzini <pbonzini@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [PATCH v2 04/23] memory: merge adjacent segments of a single memory region
Date: Tue, 26 Jul 2011 13:51:32 +0200 [thread overview]
Message-ID: <4E2EAA44.105@redhat.com> (raw)
In-Reply-To: <4E2EA71A.7000106@redhat.com>
On 07/26/2011 01:38 PM, Avi Kivity wrote:
>>
>> if (j != i) {
>>
>>> + memmove(&view->ranges[i], &view->ranges[j],
>>> + (view->nr - j) * sizeof(view->ranges[j]));
>>> + view->nr -= j - i;
>>> + }
>>
>> }
>
> Seems to work both ways?
Sure, but you're pointlessly memmove-ing memory over itself. I'm not
sure how many segments a single memory region will usually have, but
it's better to be safe.
Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH v2 04/23] memory: merge adjacent segments of a single memory region
Date: Tue, 26 Jul 2011 13:51:32 +0200 [thread overview]
Message-ID: <4E2EAA44.105@redhat.com> (raw)
In-Reply-To: <4E2EA71A.7000106@redhat.com>
On 07/26/2011 01:38 PM, Avi Kivity wrote:
>>
>> if (j != i) {
>>
>>> + memmove(&view->ranges[i], &view->ranges[j],
>>> + (view->nr - j) * sizeof(view->ranges[j]));
>>> + view->nr -= j - i;
>>> + }
>>
>> }
>
> Seems to work both ways?
Sure, but you're pointlessly memmove-ing memory over itself. I'm not
sure how many segments a single memory region will usually have, but
it's better to be safe.
Paolo
next prev parent reply other threads:[~2011-07-26 11:51 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-26 11:25 [PATCH v2 00/23] Memory API, batch 1 Avi Kivity
2011-07-26 11:25 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 01/23] Add memory API documentation Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 02/23] Hierarchical memory region API Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 03/23] memory: implement dirty tracking Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 04/23] memory: merge adjacent segments of a single memory region Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:36 ` Paolo Bonzini
2011-07-26 11:36 ` [Qemu-devel] " Paolo Bonzini
2011-07-26 11:38 ` Avi Kivity
2011-07-26 11:38 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:51 ` Paolo Bonzini [this message]
2011-07-26 11:51 ` Paolo Bonzini
2011-07-26 12:04 ` Avi Kivity
2011-07-26 12:04 ` [Qemu-devel] " Avi Kivity
2011-07-26 15:41 ` Richard Henderson
2011-07-26 15:41 ` [Qemu-devel] " Richard Henderson
2011-07-26 16:04 ` Avi Kivity
2011-07-26 11:26 ` [PATCH v2 05/23] Internal interfaces for memory API Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 06/23] memory: abstract address space operations Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 07/23] memory: rename MemoryRegion::has_ram_addr to ::terminates Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 08/23] memory: late initialization of ram_addr Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 09/23] memory: I/O address space support Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 10/23] memory: add backward compatibility for old portio registration Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 11/23] memory: add backward compatibility for old mmio registration Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 12/23] memory: add ioeventfd support Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 13/23] memory: separate building the final memory map into two steps Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 14/23] memory: transaction API Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 15/23] exec.c: initialize memory map Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 16/23] ioport: register ranges by byte aligned addresses always Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 17/23] pc: grab system_memory Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 18/23] pc: convert pc_memory_init() to memory API Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 19/23] pc: move global memory map out of pc_init1() and into its callers Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 20/23] pci: pass address space to pci bus when created Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 21/23] pci: add MemoryRegion based BAR management API Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 22/23] sysbus: add MemoryRegion based memory " Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-26 11:26 ` [PATCH v2 23/23] usb-ohci: convert to MemoryRegion Avi Kivity
2011-07-26 11:26 ` [Qemu-devel] " Avi Kivity
2011-07-29 14:18 ` [PATCH v2 00/23] Memory API, batch 1 Anthony Liguori
2011-07-29 14:18 ` [Qemu-devel] " Anthony Liguori
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=4E2EAA44.105@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=qemu-devel@nongnu.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.