Page MenuHomeFreeBSD

More checks for PG_ZERO pages
ClosedPublic

Authored by kib on Nov 21 2025, 9:01 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jan 29, 5:51 AM
Unknown Object (File)
Wed, Jan 28, 12:45 AM
Unknown Object (File)
Dec 20 2025, 4:32 AM
Unknown Object (File)
Dec 18 2025, 1:21 PM
Unknown Object (File)
Dec 16 2025, 6:55 AM
Unknown Object (File)
Dec 15 2025, 2:16 AM
Unknown Object (File)
Dec 4 2025, 6:49 PM
Unknown Object (File)
Dec 3 2025, 11:15 PM
Subscribers

Details

Summary
vm_page_free_prep(): convert PG_ZERO zeroed page check to use sf_buf

Make the check MI by allocating sf_buf in non-blockable manner.  For
DMAP arches, this should be nop since sf_buf allocation cannot fail.
For non-DMAP arches, we get the checks activated unless there is serious
sf_buf pressure, which typically should be not.

The context for vm_page_free_prep() should be ready to block on some VM
mutexes, which should make it reasonable to block on sf_buf list lock.

Move the code to INVARIANTS build, and control it with the sysctl
debug.vm_check_pg_zero.


 vm_fault: under INVARIANTS, add the verifier that PG_ZERO page is indeed zeroed

Controlled by the same sysctl debug.vm_check_pg_zero.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Nov 21 2025, 9:01 AM

Would it be sensible to compile this code under INVARIANTS and leave it disabled by default with a sysctl?

This revision is now accepted and ready to land.Nov 21 2025, 2:14 PM
kib edited the summary of this revision. (Show Details)

Move to INVARIANTS and sysctl debug.vm_check_pg_zero to control.

This revision now requires review to proceed.Nov 21 2025, 2:26 PM
markj added inline comments.
sys/vm/vm_page.c
152

Maybe this should be INVARIANTS-only too.

This revision is now accepted and ready to land.Nov 21 2025, 2:34 PM

Move control var and sysctl under INVARIANTS.

This revision now requires review to proceed.Nov 21 2025, 2:51 PM
This revision is now accepted and ready to land.Nov 21 2025, 2:58 PM