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
Unknown Object (File)
Wed, Nov 6, 2:58 PM
Unknown Object (File)
Sep 29 2024, 9:50 PM
Unknown Object (File)
Sep 13 2024, 12:48 AM
Unknown Object (File)
Sep 13 2024, 12:48 AM
Unknown Object (File)
Sep 13 2024, 12:47 AM
Unknown Object (File)
Sep 13 2024, 12:47 AM
Unknown Object (File)
Sep 13 2024, 12:45 AM
Unknown Object (File)
Sep 1 2024, 12:58 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