]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Generalize lazy dequeue logic for wired pages.
authormarkj <markj@FreeBSD.org>
Sat, 28 Dec 2019 19:03:46 +0000 (19:03 +0000)
committermarkj <markj@FreeBSD.org>
Sat, 28 Dec 2019 19:03:46 +0000 (19:03 +0000)
commitb582a8b85a6fbd269368940d470338ab1a927dcb
treeac5eaf47d55878179e94de793de4d3676efea30f
parentdc3007c624cd0b85b1e7e717d0f01725cdcc0c9c
Generalize lazy dequeue logic for wired pages.

Some recent work aims to remove the use of the page lock for
synchronizing updates to page queue state.  This change adds a mechanism
to preserve the existing behaviour of lazily dequeuing wired pages,
which was previously synchronized using the page lock.

Handle this by setting PGA_DEQUEUE when a managed page's wire count
transitions from 0 to 1.  When the page daemon encounters a page with a
flag in PGA_QUEUE_OP_MASK set, it creates a batch queue entry for that
page, but in so doing it does not modify the page itself and thus racing
with a concurrent free of the page is harmless.  The flag is advisory;
the page daemon still checks for wirings after acquiring the object and
page xbusy locks.

vm_page_unwire_managed() now clears PGA_DEQUEUE on a 1->0 transition.
It must do this before dropping the reference to avoid a use-after-free
but also handles races with concurrent wirings to ensure that
PGA_DEQUEUE is not left unset on a wired page.

Reviewed by: jeff
Tested by: pho
Sponsored by: Netflix, Intel
Differential Revision: https://reviews.freebsd.org/D22882
sys/vm/vm_page.c
sys/vm/vm_pageout.c