Skip to contentSkip to conversation

selftests/mm: uffd-missing-wp: add GC related functionality test

PATCH In review Martin Cracauer 3 participants 3 messages Sep 28

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests/mm: uffd-missing-wp: add GC related functionality test

Add a test that asserts that functionality needed for generational garbage collection works. Namely to implement a write barrier using userfaultfd instead of using segmentation faults. The planned target is the GC in SBCL.

The real GC will initially fill heap pages by using on-demand loading of pages from an image file, either via mmap(2) or using userfaultfd to decompress a page read from an image file made from individually compressed blocks. This test doesn't do that so that it needs no disk I/O and no decompression library. Instead, a fault will be filled by copying page content from prepared pages in the heap.

Assisted-by Anthropic:Opus-5.5
---
 tools/testing/selftests/mm/Makefile          |   1 +
 tools/testing/selftests/mm/uffd-missing-wp.c | 413 +++++++++++++++++++
 2 files changed, 414 insertions(+)
 create mode 100644 tools/testing/selftests/mm/uffd-missing-wp.c
tools/testing/selftests/mm/Makefile +1 -0
index d3e9bd67904a..76176d62b3b3 100644
@@ -92,6 +92,7 @@ TEST_GEN_FILES += transhuge-stress
 TEST_GEN_FILES += uffd-stress
 TEST_GEN_FILES += uffd-unit-tests
 TEST_GEN_FILES += uffd-wp-mremap
+TEST_GEN_FILES += uffd-missing-wp
 TEST_GEN_FILES += split_huge_page_test
 TEST_GEN_FILES += ksm_tests
 TEST_GEN_FILES += ksm_functional_tests
tools/testing/selftests/mm/uffd-missing-wp.c new file +413 -0

413 lines not on this page · raw message

Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 11 lines · On Sun, 27 Sep 2026 23:26:31 -0400 Martin Cracauer <[email protected]> wrote:

Add a test that asserts that functionality needed for generational garbage collection works. Namely to implement a write barrier using userfaultfd instead of using segmentation faults. The planned target is the GC in SBCL.

The real GC will initially fill heap pages by using on-demand loading of pages from an image file, either via mmap(2) or using userfaultfd to decompress a page read from an image file made from individually compressed blocks. This test doesn't do that so that it needs no disk I/O and no decompression library. Instead, a fault will be filled by copying page content from prepared pages in the heap.

Thanks. Sashiko asked a couple of things:
https://sashiko.dev/#/patchset/[email protected]

#2 lore raw
In reply to Martin Cracauer
Quoted 12 lines · Martin Cracauer

Add a test that asserts that functionality needed for generational garbage collection works. Namely to implement a write barrier using userfaultfd instead of using segmentation faults. The planned target is the GC in SBCL.

The real GC will initially fill heap pages by using on-demand loading of pages from an image file, either via mmap(2) or using userfaultfd to decompress a page read from an image file made from individually compressed blocks. This test doesn't do that so that it needs no disk I/O and no decompression library. Instead, a fault will be filled by copying page content from prepared pages in the heap.

Quoted 7 lines
Assisted-by Anthropic:Opus-5.5
---
 tools/testing/selftests/mm/Makefile          |   1 +
 tools/testing/selftests/mm/uffd-missing-wp.c | 413 +++++++++++++++++++
 2 files changed, 414 insertions(+)
 create mode 100644 tools/testing/selftests/mm/uffd-missing-wp.c

Isn't something like that a better fit for LTP?

Signature · 3 lines
Cheers,

David