From: Peter Xu <peterx@redhat.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org
Subject: Re: [PATCH v3] mm: memory: check userfaultfd_wp() in vmf_orig_pte_uffd_wp()
Date: Mon, 22 Apr 2024 08:18:33 -0400 [thread overview]
Message-ID: <ZiZVmbZ9-FGhdE2w@x1n> (raw)
In-Reply-To: <20240422030039.3293568-1-wangkefeng.wang@huawei.com>
On Mon, Apr 22, 2024 at 11:00:39AM +0800, Kefeng Wang wrote:
> Adding userfaultfd_wp() check in vmf_orig_pte_uffd_wp() to avoid the
> unnecessary FAULT_FLAG_ORIG_PTE_VALID check/pte_marker_entry_uffd_wp()
> in most pagefault, note, the function vmf_orig_pte_uffd_wp() is not
> inlined in the two kernel versions, the difference is shown below,
>
> perf date,
>
> perf report -i perf.data.before | grep vmf
> 0.17% 0.13% lat_pagefault [kernel.kallsyms] [k] vmf_orig_pte_uffd_wp.part.0.isra.0
> perf report -i perf.data.after | grep vmf
>
> lat_pagefault -W 5 -N 5 /tmp/XXX
> latency before after diff
> average(8 tests) 0.262675 0.2600375 -0.0026375
>
> Although it's a small, but the uffd_wp is a new feature than previous
> kernel, when the vma is not registered with UFFD_WP, let's avoid to
> execute the new logical, also adding __always_inline attribute to
> vmf_orig_pte_uffd_wp(), which make set_pte_range() only check VM_UFFD_WP
> flags without the function call. In addition, directly call the
> vmf_orig_pte_uffd_wp() in do_anonymous_page() and set_pte_range()
> to save an uffd_wp variable.
>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
prev parent reply other threads:[~2024-04-22 12:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 3:00 Kefeng Wang
2024-04-22 12:18 ` Peter Xu [this message]
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=ZiZVmbZ9-FGhdE2w@x1n \
--to=peterx@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=wangkefeng.wang@huawei.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