HomeFreeBSD

vm_page: Retire its listq field

Description

vm_page: Retire its listq field

Over the life cycle of a vm_page, its listq field has been used for two
distinct purposes. First, linking together all of the pages allocated
to a vm_object. Recently, c8d56817b80f ("vm_object: drop memq field")
completed the elimination of this use case, using pctrie iterators in
place of iteration over the listq. Second, linking together power-of-
two-sized chunks of free pages within vm_phys. This change eliminates
that use case. In essence, this change reverts vm_phys back to using
the plinks.q field, like it did before 5cd29d0f3cda ("Improve VM page
queue scalability."), but with a twist to maintain scalability. Just
before vm_phys uses the plinks.q field, it ensures that any lazy dequeue
from a paging queue, e.g., PQ_ACTIVE, has completed. Typically, the
dequeue has completed, so vm_page_dequeue() is infrequently called by
vm_freelist_add(). The reason being that vm_phys only needs to use the
plinks.q field within the first page of any power-of-two-sized chunk,
so the rest of the pages can still have pending dequeues until the
chunk is split.

This change saves a non-trivial amount of memory, since we have an
instance of struct vm_page for every dynamically allocatable physical
page.

Bump __FreeBSD_version, since third-party modules that use the inline
accessors in vm_page.h may need to be recompiled.

Reviewed by: dougm, kib, markj
Differential Revision: https://reviews.freebsd.org/D50515

Details

Provenance
alcAuthored on May 27 2025, 8:27 AM
Reviewer
dougm
Differential Revision
D50515: vm_page: retire its listq field
Parents
rG3a427b832084: rtw89: prevent a NULL pointer deref in rtw89_swap_chanctx()
Branches
Unknown
Tags
Unknown