[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3] mem-prealloc: reduce large guest start-up an
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v3] mem-prealloc: reduce large guest start-up and migration time. |
Date: |
Thu, 23 Feb 2017 11:01:59 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 |
On 23/02/2017 10:56, Jitendra Kolhe wrote:
> if (sigsetjmp(sigjump, 1)) {
> - error_setg(errp, "os_mem_prealloc: Insufficient free host memory "
> - "pages available to allocate guest RAM\n");
> + memset_thread_failed = true;
This sigsetjmp is not needed, no one can siglongjmp to it.
The SIG_UNBLOCK/SIG_BLOCK in the main thread is not necessary, either.
> } else {
> - int i;
> size_t hpagesize = qemu_fd_getpagesize(fd);
> size_t numpages = DIV_ROUND_UP(memory, hpagesize);
>
> - /* MAP_POPULATE silently ignores failures */
> - for (i = 0; i < numpages; i++) {
> - memset(area + (hpagesize * i), 0, 1);
> - }
> + /* touch pages simultaneously */
> + touch_all_pages(area, hpagesize, numpages, smp_cpus);
... and now touch_all_pages can just return memset_thread_failed, which
simplifies the code a bit.
Paolo
> + }
> + if (memset_thread_failed) {
> + error_setg(errp, "os_mem_prealloc: Insufficient free host memory "
> + "pages available to allocate guest RAM");
> }