HomeFreeBSD

rfork(2): fix swap accounting in vmspace_unshare()

Description

rfork(2): fix swap accounting in vmspace_unshare()

When an attempt to increase the swap charge for the ucred failed, we
must forcibly increase the charge to allow the vmspace_destroy()
operation to correctly un-charge the accumulated objects.

Add a swap_reserve_force_by_cred() helper and use it in
vmspace_unshare(), same as it is done in normal fork operations.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D54572

Details

Provenance
kibAuthored on Jan 4 2026, 12:19 AM
Reviewer
markj
Differential Revision
D54572: Fix charge accounting for objects
Parents
rG7361727d4584: swap_release_by_cred*(): give some additional info on panics due to underflow
Branches
Unknown
Tags
Unknown