HomeFreeBSD

vm_object: remove the charge member

Description

vm_object: remove the charge member

State that the object charge is zero if object->cred == NULL, or equal
to the ptoa(object->size) otherwise.

Besides being much simpler, the transition to use object->size corrects
the architectural issue with the use of object->charge. The split
operations effectively carve the holes in the charged regions, but
single counter cannot properly express it. As result, coalescing
anonymous mappings cannot calculate correctly if the extended mapping
already backed by the existing object is already accounted or not [1].

To properly solve the issue, either we need to start tracking exact
charged regions in the anonymous objects, which has the significant
overhead and complications. Or give up on the slight over-accounting
and charge the whole object unconditionally, as it is done in the patch.

Reported by: mmel, pho [1]
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 3 2026, 9:34 AM
Reviewer
markj
Differential Revision
D54572: Fix charge accounting for objects
Parents
rGde770681234d: rfork(2): fix swap accounting in vmspace_unshare()
Branches
Unknown
Tags
Unknown