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)
Sat, Feb 28, 10:49 PM
Unknown Object (File)
Sat, Feb 28, 5:26 PM
Unknown Object (File)
Sat, Feb 28, 5:02 AM
Unknown Object (File)
Mon, Feb 23, 11:07 PM
Unknown Object (File)
Sun, Feb 22, 11:21 PM
Unknown Object (File)
Fri, Feb 20, 5:47 AM
Unknown Object (File)
Thu, Feb 19, 4:18 PM
Unknown Object (File)
Wed, Feb 18, 7:47 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