git: 45cde0e43918 - main - vm_page: add vm_page_clearref() helper
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 15 Jul 2024 07:13:33 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45cde0e439188589ca2511f6fd76829cbf68267e commit 45cde0e439188589ca2511f6fd76829cbf68267e Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-07-08 17:45:33 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-07-15 06:15:50 +0000 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 --- sys/vm/vm_page.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h index f419ba8e3d34..49f4c0fbc0cb 100644 --- a/sys/vm/vm_page.h +++ b/sys/vm/vm_page.h @@ -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: *