Skip to contentSkip to conversation

Add option to mlock qemu and guest memory

PATCH Chegu Vinod 2 participants 2 messages Apr 22, 2013 – Apr 23, 2013

lore
Share & tools
lore
#0 lore raw

Hi Satoru,

FYI... I had tried to use this change earlier and it did show some improvements in perf. (due to reduced exits).

But as expected mlockall () on large sized guests adds a considerable delay in boot time. For e.g. on an 8 socket Westmere box => a 256G guest : took an additional ~2+ mins to boot and a 512G guest took an additional ~5+ mins to boot. This is mainly due to long time spent in trying to clear all the pages.

    77.96%         35728  qemu-system-x86  [kernel.kallsyms]     [k] 
clear_page_c
            |
            --- clear_page_c
                hugetlb_no_page
                hugetlb_fault
                follow_hugetlb_page
                __get_user_pages
                __mlock_vma_pages_range
                __mm_populate
                vm_mmap_pgoff
                sys_mmap_pgoff
                sys_mmap
                system_call
                __GI___mmap64
                qemu_ram_alloc_from_ptr
                qemu_ram_alloc
                memory_region_init_ram
                pc_memory_init
                pc_init1
                pc_init_pci
                main
                __libc_start_main

Need to have a faster way to clear pages.
Vinod

#1 lore raw

Hi Vinod,

Thank you for your report.

Quoted 5 lines · Chegu Vinod

FYI... I had tried to use this change earlier and it did show some improvements in perf. (due to reduced exits).

But as expected mlockall () on large sized guests adds a considerable delay in boot time.

Yes, it is expected.

Quoted 28 lines

For e.g. on an 8 socket Westmere box => a 256G guest :
took an additional ~2+ mins to boot and a 512G guest took an additional ~5+ mins to boot. This is mainly due to long time spent in trying to clear all the pages.

    77.96%         35728  qemu-system-x86  [kernel.kallsyms]     [k] clear_page_c
            |
            --- clear_page_c
                hugetlb_no_page
                hugetlb_fault
                follow_hugetlb_page
                __get_user_pages
                __mlock_vma_pages_range
                __mm_populate
                vm_mmap_pgoff
                sys_mmap_pgoff
                sys_mmap
                system_call
                __GI___mmap64
                qemu_ram_alloc_from_ptr
                qemu_ram_alloc
                memory_region_init_ram
                pc_memory_init
                pc_init1
                pc_init_pci
                main
                __libc_start_main
Quoted 1 line

Need to have a faster way to clear pages.

Hmm, clear_page() just calls memset(page, 0, PAGE_SIZE)... The patch has just merged today. I'll start to think of the issue above.

Regards,
Satoru