[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 2/7] util/oslib-posix: Support MADV_POPULATE_WRITE for os_
From: |
Daniel P . Berrangé |
Subject: |
Re: [PATCH v3 2/7] util/oslib-posix: Support MADV_POPULATE_WRITE for os_mem_prealloc() |
Date: |
Tue, 28 Sep 2021 17:45:14 +0100 |
User-agent: |
Mutt/2.0.7 (2021-05-04) |
On Mon, Aug 16, 2021 at 11:47:34AM +0200, David Hildenbrand wrote:
> Let's sense support and use it for preallocation. MADV_POPULATE_WRITE
> does not require a SIGBUS handler, doesn't actually touch page content,
> and avoids context switches; it is, therefore, faster and easier to handle
> than our current approach.
>
> While MADV_POPULATE_WRITE is, in general, faster than manual
> prefaulting, and especially faster with 4k pages, there is still value in
> prefaulting using multiple threads to speed up preallocation.
>
> More details on MADV_POPULATE_WRITE can be found in the Linux commits
> 4ca9b3859dac ("mm/madvise: introduce MADV_POPULATE_(READ|WRITE) to prefault
> page tables") and eb2faa513c24 ("mm/madvise: report SIGBUS as -EFAULT for
> MADV_POPULATE_(READ|WRITE)"), and in the man page proposal [1].
>
> This resolves the TODO in do_touch_pages().
>
> In the future, we might want to look into using fallocate(), eventually
> combined with MADV_POPULATE_READ, when dealing with shared file/fd
> mappings and not caring about memory bindings.
>
> [1] https://lkml.kernel.org/r/20210816081922.5155-1-david@redhat.com
>
> Reviewed-by: Pankaj Gupta <pankaj.gupta@ionos.com>
> Signed-off-by: David Hildenbrand <david@redhat.com>
> ---
> include/qemu/osdep.h | 7 ++++
> util/oslib-posix.c | 83 +++++++++++++++++++++++++++++++++-----------
> 2 files changed, 69 insertions(+), 21 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH v3 2/7] util/oslib-posix: Support MADV_POPULATE_WRITE for os_mem_prealloc(),
Daniel P . Berrangé <=