Skip to content

Commit

Permalink
vm_page: add vm_page_clearref() helper
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kostikbel committed Jul 15, 2024
1 parent ec1b18c commit 45cde0e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sys/vm/vm_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
Expand Down

0 comments on commit 45cde0e

Please sign in to comment.