vm: avoid lock upgrade if possible in vm_fault_next

In my tests during buildkernel fs->m was always NULL at that stage.

Note the change has no impact on vm obj contention during said workload.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D39027
This commit is contained in:
Mateusz Guzik 2023-03-11 20:57:24 +00:00
parent 1a79144827
commit 3c3a434f8e

View file

@ -1092,7 +1092,7 @@ vm_fault_next(struct faultstate *fs)
if (fs->object == fs->first_object) {
fs->first_m = fs->m;
fs->m = NULL;
} else {
} else if (fs->m != NULL) {
if (!vm_fault_object_ensure_wlocked(fs)) {
fs->can_read_lock = false;
unlock_and_deallocate(fs);