HomeFreeBSD

vm: Reduce address space fragmentation

Description

vm: Reduce address space fragmentation

jemalloc performs two types of virtual memory allocations: (1) large
chunks of virtual memory, where the chunk size is a multiple of a
superpage and explicitly aligned, and (2) small allocations, mostly
128KB, where no alignment is requested. Typically, it starts with a
small allocation, and over time it makes both types of allocation.

With anon_loc being updated on every allocation, we wind up with a
repeating pattern of a small allocation, a large gap, and a large,
aligned allocation. (As an aside, we wind up allocating a reservation
for these small allocations, but it will never fill because the next
large, aligned allocation updates anon_loc, leaving a gap that will
never be filled with other small allocations.)

With this change, anon_loc isn't updated on every allocation. So, the
small allocations will be clustered together, the large allocations will
be clustered together, and there will be fewer gaps between the
anonymous memory allocations. In addition, I see a small reduction in
reservations allocated (e.g., 1.6% during buildworld), fewer partially
populated reservations, and a small increase in 64KB page promotions on
arm64.

Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39845

Details

Provenance
alcAuthored on Jun 9 2024, 4:58 PM
Reviewer
kib
Differential Revision
D39845: VM anonymous clustering: be more persistent
Parents
rGa7f67ebd8275: subr_rangeset: use pctrie_reclaim_cb in remove_all
Branches
Unknown
Tags
Unknown