From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Muhammad Usama Anjum <usama.anjum@collabora.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Axel Rasmussen <axelrasmussen@google.com>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Nadav Amit <nadav.amit@gmail.com>,
Paul Gofman <pgofman@codeweavers.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v3 1/2] mm/uffd: UFFD_FEATURE_WP_UNPOPULATED
Date: Wed, 8 Mar 2023 16:57:55 +0100 [thread overview]
Message-ID: <83b3f3ad-19a2-3737-77dd-3c3f9db82194@redhat.com> (raw)
In-Reply-To: <ZAiqPU0RX3JfDFRP@x1n>
>>
>>> With WP_UNPOPUATED, application like QEMU can avoid pre-read faults all the
>>> memory before wr-protect during taking a live snapshot. Quotting from
>>> Muhammad's test result here [3] based on a simple program [4]:
>>>
>>> (1) With huge page disabled
>>> echo madvise > /sys/kernel/mm/transparent_hugepage/enabled
>>> ./uffd_wp_perf
>>> Test DEFAULT: 4
>>> Test PRE-READ: 1111453 (pre-fault 1101011)
>>> Test MADVISE: 278276 (pre-fault 266378)
>>> Test WP-UNPOPULATE: 11712
>>>
>>> (2) With Huge page enabled
>>> echo always > /sys/kernel/mm/transparent_hugepage/enabled
>>> ./uffd_wp_perf
>>> Test DEFAULT: 4
>>> Test PRE-READ: 22521 (pre-fault 22348)
>>> Test MADVISE: 4909 (pre-fault 4743)
>>> Test WP-UNPOPULATE: 14448
>>>
>>> There'll be a great perf boost for no-thp case, while for thp enabled with
>>> extreme case of all-thp-zero WP_UNPOPULATED can be slower than MADVISE, but
>>> that's low possibility in reality, also the overhead was not reduced but
>>> postponed until a follow up write on any huge zero thp, so potentitially it
>>
>> s/potentitially/potentially/
>>
>>> is faster by making the follow up writes slower.
>>
>> What I realized, interrestingly not only the writes, but also the reads. In
>
> Curious why reading a zeropage would be a problem?
Oh, my thinking was that with markers you postpone placing the shared
zeropage. So the next read access will require a pagefault to map the
shared zeropage. Your v1 would have performed best in that case I guess.
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2023-03-08 15:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-06 21:39 [PATCH v3 0/2] mm/uffd: Add feature bit UFFD_FEATURE_WP_UNPOPULATED Peter Xu
2023-03-06 21:39 ` [PATCH v3 1/2] mm/uffd: UFFD_FEATURE_WP_UNPOPULATED Peter Xu
2023-03-07 16:11 ` David Hildenbrand
2023-03-08 15:31 ` Peter Xu
2023-03-08 15:57 ` David Hildenbrand [this message]
2023-03-08 16:51 ` Peter Xu
2023-03-08 17:04 ` David Hildenbrand
2023-03-06 21:39 ` [PATCH v3 2/2] selftests/mm: Smoke test WP_UNPOPULATED Peter Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83b3f3ad-19a2-3737-77dd-3c3f9db82194@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nadav.amit@gmail.com \
--cc=peterx@redhat.com \
--cc=pgofman@codeweavers.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=usama.anjum@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox