userfaultfd: support access/write hints
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest posting 2/24 of 5 patches 15 repliesIn review
- v2 RFC posting 1/25 patches 16 repliesSuperseded
Changes in v2 from the cover letter
* Leave dirty-bit as it was before [Peter Xu]
4 of 5 patches are in this archive. The cover letter announces 5.
Patches in v2 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 2/5 | userfaultfd: introduce access-likely mode for common operationsfs/ include/ include/ +3 more | +77 | 6 replies | |
| 3/5 | userfaultfd: introduce write-likely mode for uffd operationsfs/ include/ include/ | +37 | 3 replies | |
| 4/5 | userfaultfd: zero access/write hintsmm/ | +35 | 1 reply | |
| 5/5 | selftest/userfaultfd: test read/write hintstools/ tools/ | +62 | 0 replies |
Reviews trailers per patch
1 of 4 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Peter Xu | David Hildenbrand | Mike Rapoport |
|---|---|---|---|
| Series | A-b | R-b | A-b |
| 2/5 | |||
| 3/5 | |||
| 4/5 | A-b | R-b | |
| 5/5 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v2 0/5] userfaultfd: support access/write hints
From: Nadav Amit <[email protected]>
This patch-set introduces access/write hints for userfaultfd. Unlike the previous versions, the use of these hints in this version is limited. Yet, in order to keep introducing new features again and again, hints are introduced for all of uffd related ioctls.
The access-hint is currently used to set the young bit, similarly to do_set_pte(). This has no effect on x86, but may on arm64.
When a write-hint is provided on zeropage ioctl, a clear page is allocated instead of mapping the zero-page.
Future patches would use the write-hint to decide whether to map the writable pages on write-(un)protect ioctl.
Setting the access-bit and dirty-bit introduces a tradeoff. When the bit is set access/write is faster, but memory reclamation might be slower. Currently, in the common userfaultfd cases the access-bit is not set on and the dirty-bit is set. This is a questionable behavior.
Allow userspace to control this behavior through hints access- and write-likely hints. These hints are used to control access- and dirty-bits. For zero-pages that with write-likely hint, allocate a clear page instead of mapping the zero-page.
v1 -> v2:
* Leave dirty-bit as it was before [Peter Xu]
RFCv2 -> v1:
* Adding hints to zeropage and continue
* Fixing other issues pointed by David H. & Peter Xu
* Adding tests to ./run_vmtests.sh
Nadav Amit (5):
userfaultfd: introduce uffd_flags
userfaultfd: introduce access-likely mode for common operations
userfaultfd: introduce write-likely mode for uffd operations
userfaultfd: zero access/write hints selftest/userfaultfd: test read/write hints
fs/userfaultfd.c | 77 ++++++++++++++-- include/linux/hugetlb.h | 4 +- include/linux/shmem_fs.h | 8 +- include/linux/userfaultfd_k.h | 26 ++++-- include/uapi/linux/userfaultfd.h | 31 ++++++- mm/hugetlb.c | 3 +- mm/internal.h | 13 +++ mm/memory.c | 12 --- mm/shmem.c | 6 +- mm/userfaultfd.c | 103 +++++++++++++++------- tools/testing/selftests/vm/run_vmtests.sh | 16 ++-- tools/testing/selftests/vm/userfaultfd.c | 54 +++++++++++- 12 files changed, 275 insertions(+), 78 deletions(-)
Signature · 1 line
2.25.1