Page MenuHomeFreeBSD

vm: add unlocked page lookup before trying vm_fault_soft_fast
ClosedPublic

Authored by mjg on Mar 25 2023, 3:53 PM.
Tags
None
Referenced Files
F145126830: D39268.id119451.diff
Mon, Feb 16, 6:10 AM
F145126821: D39268.id119451.diff
Mon, Feb 16, 6:10 AM
Unknown Object (File)
Sat, Feb 14, 6:36 PM
Unknown Object (File)
Sun, Feb 8, 3:10 PM
Unknown Object (File)
Sun, Feb 8, 8:26 AM
Unknown Object (File)
Sat, Feb 7, 6:30 PM
Unknown Object (File)
Fri, Jan 30, 8:25 PM
Unknown Object (File)
Dec 26 2025, 2:43 PM
Subscribers

Details

Summary
Shaves a read lock + tryupgrade trip most of the time.

Stats from doing a kernel build (counters not present in the tree):
vm.fault_soft_fast_ok: 262653
vm.fault_soft_fast_failed_other: 41
vm.fault_soft_fast_failed_no_page: 39595772
vm.fault_soft_fast_failed_page_busy: 1929
vm.fault_soft_fast_failed_page_invalid: 22183

Diff Detail

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

Event Timeline

mjg requested review of this revision.Mar 25 2023, 3:53 PM
sys/vm/vm_fault.c
365–366

There is no reason to busy the object if the page lookup validation fails, since you check for the busy page status in separate statement.

366–374

There should be a blank line before the multiline comment

372

And the blank line after the block of code described by the multiline comment

sys/vm/vm_fault.c
365–366

you mean something like this?

if (m->object != fs->first_object || m->pindex != fs->first_pindex)
        goto fail;

vm_object_busy(fs->first_object);

if (!vm_page_all_valid(m) ||
    ((fs->prot & VM_PROT_WRITE) != 0 && vm_page_busied(m)))
        goto fail_busy;
sys/vm/vm_fault.c
365–366

Yes

mjg marked 4 inline comments as done.
This revision is now accepted and ready to land.Mar 25 2023, 9:49 PM