[PATCH v4 0/6] vdso/datastore: Allow prefaulting by mlockall()

From: Thomas Weißschuh

Date: Tue Jun 30 2026 - 03:36:08 EST


While mlockall() is meant to lock page *memory*, effectively it will
also create and lock the corresponding page table entries.
Latency-sensitive applications expect not to experience any pagefaults
after calling mlockall(). However mlockall() ignores VM_IO mappings,
which is used by the generic vDSO datastore.
While the fault handler itself is very fast, going through the full
pagefault exception handling is much slower, on the order of 20us in a
test machine.

Since the memory behind the datastore mappings is always present and
accessible it is not necessary to use VM_IO for them.

---
Changes in v4:
- Rebase on v7.2-rc1
- Extend commit messages
- Link to v3: https://patch.msgid.link/20260518-vdso-mlockall-v3-0-bf4f2af2b41f@xxxxxxxxxxxxx

Changes in v3:
- Rebase on v7.1-rc1
- Stop using zero page, which can not be mapped in this way
- Link to v2: https://lore.kernel.org/r/20250901-vdso-mlockall-v2-0-68f5a6f03345@xxxxxxxxxxxxx

Changes in v2:
- Stop using nth_page() which is being removed
- Link to v1: https://lore.kernel.org/r/20250812-vdso-mlockall-v1-0-2f49ba7cf819@xxxxxxxxxxxxx

To: Anna-Maria Behnsen <anna-maria@xxxxxxxxxxxxx>
To: Frederic Weisbecker <frederic@xxxxxxxxxx>
To: Thomas Gleixner <tglx@xxxxxxxxxx>
To: Andy Lutomirski <luto@xxxxxxxxxx>
To: Vincenzo Frascino <vincenzo.frascino@xxxxxxx>
Cc: Nam Cao <namcao@xxxxxxxxxxxxx>
Cc: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: David Hildenbrand <david@xxxxxxxxxx>
Cc: Jason Gunthorpe <jgg@xxxxxxxx>
Cc: John Hubbard <jhubbard@xxxxxxxxxx>
Cc: Peter Xu <peterx@xxxxxxxxxx>
Cc: linux-mm@xxxxxxxxx
Cc: Lorenzo Stoakes <ljs@xxxxxxxxxx>
Cc: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxxxxx>
Cc: Mike Rapoport <rppt@xxxxxxxxxx>
Cc: Suren Baghdasaryan <surenb@xxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>

---
Thomas Weißschuh (6):
vdso/datastore: Rename data pages variable
vdso/datastore: Map pages in terms of the faults pgoff
vdso/datastore: Map zeroed pages for unavailable data
vdso/datastore: Explicitly prevent remote access to timens vvar page
vdso/datastore: Allow prefaulting by mlockall()
vdso/datastore: Simplify the mapping logic for VDSO_TIME_PAGE_OFFSET

kernel/time/namespace_vdso.c | 7 ++---
lib/vdso/datastore.c | 65 ++++++++++++++++++++------------------------
2 files changed, 32 insertions(+), 40 deletions(-)
---
base-commit: 0f4c4aeffbe38fb638f9a978bfb64caa582c2681
change-id: 20250721-vdso-mlockall-461bb33205b1

Best regards,
--
Thomas Weißschuh (Schneider Electric) <thomas.weissschuh@xxxxxxxxxxxxx>