qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] find_ram_offset: Align ram_addr_t allocation on


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 2/2] find_ram_offset: Align ram_addr_t allocation on long boundaries
Date: Wed, 10 Jan 2018 15:25:15 +0100

From: "Dr. David Alan Gilbert" <address@hidden>

The dirty bitmaps are built from 'long's and there is fast-path code
for synchronising the case where the RAMBlock is aligned to the start
of a long boundary.  Align the allocation to this boundary
to cause the fast path to be used.

Offsets before change:
address@hidden:find_ram_offset size: 0x1e0000 @ 0x8000000
address@hidden:find_ram_offset size: 0x20000 @ 0x81e0000
address@hidden:find_ram_offset size: 0x20000 @ 0x8200000
address@hidden:find_ram_offset size: 0x1000000 @ 0x8220000
address@hidden:find_ram_offset size: 0x10000 @ 0x9220000
address@hidden:find_ram_offset size: 0x40000 @ 0x9230000
address@hidden:find_ram_offset size: 0x200000 @ 0x9270000
address@hidden:find_ram_offset size: 0x1000 @ 0x9470000
address@hidden:find_ram_offset size: 0x1000 @ 0x9471000

after change:
address@hidden:find_ram_offset size: 0x1e0000 @ 0x8000000
address@hidden:find_ram_offset size: 0x20000 @ 0x8200000
address@hidden:find_ram_offset size: 0x20000 @ 0x8240000
address@hidden:find_ram_offset size: 0x1000000 @ 0x8280000
address@hidden:find_ram_offset size: 0x10000 @ 0x9280000
address@hidden:find_ram_offset size: 0x40000 @ 0x92c0000
address@hidden:find_ram_offset size: 0x200000 @ 0x9300000
address@hidden:find_ram_offset size: 0x1000 @ 0x9500000
address@hidden:find_ram_offset size: 0x1000 @ 0x9540000

Suggested-by: Paolo Bonzini <address@hidden>
Signed-off-by: Dr. David Alan Gilbert <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
---
 exec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/exec.c b/exec.c
index 829f9d8d1a..c543b54094 100644
--- a/exec.c
+++ b/exec.c
@@ -1679,7 +1679,11 @@ static ram_addr_t find_ram_offset(ram_addr_t size)
     RAMBLOCK_FOREACH(block) {
         ram_addr_t candidate, next = RAM_ADDR_MAX;
 
+        /* Align blocks to start on a 'long' in the bitmap
+         * which makes the bitmap sync'ing take the fast path.
+         */
         candidate = block->offset + block->max_length;
+        candidate = ROUND_UP(candidate, BITS_PER_LONG << TARGET_PAGE_BITS);
 
         /* Search for the closest following block
          * and find the gap.
-- 
2.14.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]