[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/6] util/oslib-posix: Avoid creating a single thread with
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [PATCH v2 4/6] util/oslib-posix: Avoid creating a single thread with MADV_POPULATE_WRITE |
Date: |
Tue, 27 Jul 2021 20:04:05 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
* David Hildenbrand (david@redhat.com) wrote:
> Let's simplify the case when we only want a single thread and don't have
> to mess with signal handlers.
>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> util/oslib-posix.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index a1d309d495..1483e985c6 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -568,6 +568,14 @@ static bool touch_all_pages(char *area, size_t
> hpagesize, size_t numpages,
> }
>
> if (use_madv_populate_write) {
> + /* Avoid creating a single thread for MADV_POPULATE_WRITE */
> + if (context.num_threads == 1) {
> + if (qemu_madvise(area, hpagesize * numpages,
> + QEMU_MADV_POPULATE_WRITE)) {
Do you never have to fall back if this particular memory region is the
one that can't do madv?
Dave
> + return true;
> + }
> + return false;
> + }
> touch_fn = do_madv_populate_write_pages;
> } else {
> touch_fn = do_touch_pages;
> --
> 2.31.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
- [PATCH v2 1/6] util/oslib-posix: Support MADV_POPULATE_WRITE for os_mem_prealloc(), (continued)
[PATCH v2 2/6] util/oslib-posix: Introduce and use MemsetContext for touch_all_pages(), David Hildenbrand, 2021/07/22
[PATCH v2 3/6] util/oslib-posix: Don't create too many threads with small memory or little pages, David Hildenbrand, 2021/07/22
[PATCH v2 4/6] util/oslib-posix: Avoid creating a single thread with MADV_POPULATE_WRITE, David Hildenbrand, 2021/07/22
[PATCH v2 5/6] util/oslib-posix: Support concurrent os_mem_prealloc() invocation, David Hildenbrand, 2021/07/22
[PATCH v2 6/6] util/oslib-posix: Forward SIGBUS to MCE handler under Linux, David Hildenbrand, 2021/07/22