diff options
| author | Konstantin Belousov <kib@FreeBSD.org> | 2025-07-24 10:47:52 +0000 |
|---|---|---|
| committer | Konstantin Belousov <kib@FreeBSD.org> | 2025-10-13 00:23:45 +0000 |
| commit | f4d5c6d65168d3d9b99a2332d854c14b231188e6 (patch) | |
| tree | 195327a64566b140c9d5ceb2c2d4d174c150bb8e /sys/vm | |
| parent | e7422f7dfd0e4c1f0db5560f171260d78bad9383 (diff) | |
Diffstat (limited to 'sys/vm')
| -rw-r--r-- | sys/vm/vm_fault.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 796b4c44b3f9..9ba96ab888d6 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -991,6 +991,16 @@ vm_fault_relookup(struct faultstate *fs) return (KERN_SUCCESS); } +static bool +vm_fault_can_cow_rename(struct faultstate *fs) +{ + return ( + /* Only one shadow object and no other refs. */ + fs->object->shadow_count == 1 && fs->object->ref_count == 1 && + /* No other ways to look the object up. */ + fs->object->handle == NULL && (fs->object->flags & OBJ_ANON) != 0); +} + static void vm_fault_cow(struct faultstate *fs) { @@ -1008,15 +1018,7 @@ vm_fault_cow(struct faultstate *fs) * object so that it will go out to swap when needed. */ is_first_object_locked = false; - if ( - /* - * Only one shadow object and no other refs. - */ - fs->object->shadow_count == 1 && fs->object->ref_count == 1 && - /* - * No other ways to look the object up - */ - fs->object->handle == NULL && (fs->object->flags & OBJ_ANON) != 0 && + if (vm_fault_can_cow_rename(fs) && /* * We don't chase down the shadow chain and we can acquire locks. */ |
