Skip to contentSkip to conversation

exec: remove duplicate madvise to QEMU_MADV_DONTFORK

RFC PATCH In review Cao jin 2 participants 2 messages Sep 9, 2016

lore
Share & tools
lore

Cao jin

author
#0 lore raw

RFC PATCH 1/1 exec: remove duplicate madvise to QEMU_MADV_DONTFORK

kvm_setup_guest_memory() also just does "madivse to QEMU_MADV_DONTFORK".

---

Though I don't understand these code well, tt seems is duplicate code to me. But I am not sure whether I am doing the right thing, so, RFC.

 exec.c | 3 ---
 1 file changed, 3 deletions(-)
exec.c +0 -3
index 80398b0..819f7cd 100644
@@ -1623,9 +1623,6 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
         qemu_ram_setup_dump(new_block->host, new_block->max_length);
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
-        if (kvm_enabled()) {
-            kvm_setup_guest_memory(new_block->host, new_block->max_length);
-        }
     }
 }
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 17 lines · Cao jin

kvm_setup_guest_memory() also just does "madivse to QEMU_MADV_DONTFORK".

---

Though I don't understand these code well, tt seems is duplicate code to me. But I am not sure whether I am doing the right thing, so, RFC.

 exec.c | 3 ---
 1 file changed, 3 deletions(-)
exec.c +0 -0
index 80398b0..819f7cd 100644

exec.c static void ram_block_add(RAMBlock *new_block, Error **errp) · line 1628

Quoted 9 lines
exec.c +0 -3
@@ -1623,9 +1623,6 @@ static void ram_block_add(RAMBlock *new_block, Error **errp)
         qemu_ram_setup_dump(new_block->host, new_block->max_length);
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_HUGEPAGE);
         qemu_madvise(new_block->host, new_block->max_length, QEMU_MADV_DONTFORK);
-        if (kvm_enabled()) {
-            kvm_setup_guest_memory(new_block->host, new_block->max_length);
-        }
     }
 }
 

I guess it can be removed. If you want to do so, please remove kvm_setup_guest_memory completely. Also please add a comment before the qemu_madvise, saying that this is also needed by KVM if there is no synchronous MMU.

Paolo