vm_page: add vm_page_clearref() helper

It is supposed to be used for ref_count manipulations when the pages
are owned by an object, but ref_count is used for something else than
the wiring, e.g. PTE population count on the page table page.

Reviewed by:	markj
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D45910
This commit is contained in:
Konstantin Belousov 2024-07-08 20:45:33 +03:00
parent ec1b18c735
commit 45cde0e439

View File

@ -947,6 +947,17 @@ vm_page_in_laundry(vm_page_t m)
return (queue == PQ_LAUNDRY || queue == PQ_UNSWAPPABLE);
}
static inline void
vm_page_clearref(vm_page_t m)
{
u_int r;
r = m->ref_count;
while (atomic_fcmpset_int(&m->ref_count, &r, r & (VPRC_BLOCKED |
VPRC_OBJREF)) == 0)
;
}
/*
* vm_page_drop:
*