From: Nadav Amit <namit@vmware.com>
To: Peter Xu <peterx@redhat.com>
Cc: Linux MM <linux-mm@kvack.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Axel Rasmussen <axelrasmussen@google.com>,
David Hildenbrand <david@redhat.com>,
Mike Rapoport <rppt@linux.ibm.com>
Subject: Re: [PATCH v1 2/5] userfaultfd: introduce access-likely mode for common operations
Date: Thu, 23 Jun 2022 23:35:00 +0000 [thread overview]
Message-ID: <DA8F1C60-9B71-42A4-9512-F267EC949B60@vmware.com> (raw)
In-Reply-To: <YrT2L3g2E8jT7ZKd@xz-m1.local>
On Jun 23, 2022, at 4:24 PM, Peter Xu <peterx@redhat.com> wrote:
> ⚠ External Email
>
> On Wed, Jun 22, 2022 at 11:50:35AM -0700, Nadav Amit wrote:
>> From: Nadav Amit <namit@vmware.com>
>>
>> Using a PTE on x86 with cleared access-bit (aka young-bit)
>> takes ~600 cycles more than when the access bit is set. At the same
>> time, setting the access-bit for memory that is not used (e.g.,
>> prefetched) can introduce greater overheads, as the prefetched memory is
>> reclaimed later than it should be.
>>
>> Userfaultfd currently does not set the access-bit (excluding the
>> huge-pages case). Arguably, it is best to let the user control whether
>> the access bit should be set or not. The expected use is to request
>> userfaultfd to set the access-bit when the copy/wp operation is done to
>> resolve a page-fault, and not to set the access-bit when the memory is
>> prefetched.
>>
>> Introduce UFFDIO_[op]_ACCESS_LIKELY to enable userspace to request the
>> young bit to be set.
>>
>> Cc: Mike Kravetz <mike.kravetz@oracle.com>
>> Cc: Hugh Dickins <hughd@google.com>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Axel Rasmussen <axelrasmussen@google.com>
>> Cc: Peter Xu <peterx@redhat.com>
>> Cc: David Hildenbrand <david@redhat.com>
>> Cc: Mike Rapoport <rppt@linux.ibm.com>
>> Signed-off-by: Nadav Amit <namit@vmware.com>
>
> Hmm.. is the hugetlb code overlooked (for both of the hints), or maybe I
> missed it? Do we need to cover them too? Thanks,
I do not know what the value of not setting the PTE’s access/dirty when it
comes to performance. The pages won’t be swapped out, just as you wrote in
your comment in hugetlb_mcopy_atomic_pte():
/*
* Always mark UFFDIO_COPY page dirty; note that this may not be
* extremely important for hugetlbfs for now since swapping is not
* supported, but we should still be clear in that this page cannot be
* thrown away at will, even if write bit not set.
*/
_dst_pte = huge_pte_mkdirty(_dst_pte);
_dst_pte = pte_mkyoung(_dst_pte);
If you want for consistency/robustness not to set dirty on read-only
entries, that’s something that I can do.
next prev parent reply other threads:[~2022-06-23 23:35 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-22 18:50 [PATCH v1 0/5] userfaultfd: support access/write hints Nadav Amit
2022-06-22 18:50 ` [PATCH v1 1/5] userfaultfd: introduce uffd_flags Nadav Amit
2022-06-23 21:57 ` Peter Xu
2022-06-23 22:04 ` Nadav Amit
2022-06-22 18:50 ` [PATCH v1 2/5] userfaultfd: introduce access-likely mode for common operations Nadav Amit
2022-06-23 23:24 ` Peter Xu
2022-06-23 23:35 ` Nadav Amit [this message]
2022-06-23 23:49 ` Peter Xu
2022-06-24 0:03 ` Nadav Amit
2022-06-24 2:05 ` Peter Xu
2022-06-24 2:42 ` Nadav Amit
2022-06-24 21:58 ` Peter Xu
2022-06-24 22:17 ` Peter Xu
2022-06-25 7:49 ` Nadav Amit
2022-06-27 13:12 ` Peter Xu
2022-06-27 13:27 ` David Hildenbrand
2022-06-27 14:59 ` Peter Xu
2022-06-27 23:37 ` Nadav Amit
2022-06-28 10:55 ` David Hildenbrand
2022-06-28 19:15 ` Peter Xu
2022-06-28 20:30 ` Nadav Amit
2022-06-28 20:56 ` Peter Xu
2022-06-28 21:03 ` Nadav Amit
2022-06-28 21:12 ` Peter Xu
2022-06-28 21:15 ` Nadav Amit
2022-07-12 6:19 ` Nadav Amit
2022-07-12 14:56 ` Peter Xu
2022-07-13 1:09 ` Nadav Amit
2022-07-13 16:02 ` Peter Xu
2022-07-13 16:49 ` Nadav Amit
2022-06-22 18:50 ` [PATCH v1 3/5] userfaultfd: introduce write-likely mode for uffd operations Nadav Amit
2022-06-22 18:50 ` [PATCH v1 4/5] userfaultfd: zero access/write hints Nadav Amit
2022-06-23 23:34 ` Peter Xu
2022-06-22 18:50 ` [PATCH v1 5/5] selftest/userfaultfd: test read/write hints Nadav Amit
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=DA8F1C60-9B71-42A4-9512-F267EC949B60@vmware.com \
--to=namit@vmware.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=peterx@redhat.com \
--cc=rppt@linux.ibm.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