HomeFreeBSD

vm_object_coalesce(): do not account holes twice

Description

vm_object_coalesce(): do not account holes twice

alc wrote:
Suppose that the object is OBJ_ONEMAPPING and that we, in fact,
have a single mapping to it. Then, we punch a hole in that mapping.
vm_map_entry_delete() only subtracts from the object's charge when
we shrink the size of the object. Now, suppose that we perform
mmap(MAP_ANON) to reallocate some of the hole. Aren't we going to add to
the charge here, even though vm_map_entry_delete() never subtracted from
the charge for the hole that was created?

Only account the change in the charged object size that was added to it.

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

Details

Provenance
kibAuthored on Nov 27 2025, 9:53 PM
Reviewer
alc
Differential Revision
D54263: vm_object_coalesce(): do not account holes twice
Parents
rGe7053d9a126a: vm_object_coalesce(): simplify common expression
Branches
Unknown
Tags
Unknown