Page MenuHomeFreeBSD

Allow vm_page_free_prep() to dequeue pages without the page lock.

Authored by markj on Feb 2 2019, 7:08 PM.



This is a step towards being able to free pages without holding the page
lock. Once hold_count/wire_count are merged and the PG_UNHOLDFREE
mechanism is removed, only the vm_page_remove() call will require the
page lock, and this will be dealt with separately.

The approach is simply to add an implementation of
vm_page_dequeue_deferred() which does not assert that the page lock is
held. Formally, we require the page lock in order to set PGA_DEQUEUE.
(The page queue lock is required to clear the flag and assign
m->queue = PQ_NONE.) However, if the page is being freed, we can
assume that no other thread is concurrently scheduling a queue operation
for the page, so we have mutual exclusion anyway.

No functional change intended.

Diff Detail

rS FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

markj created this revision.Feb 2 2019, 7:08 PM
markj added reviewers: alc, kib, jeff.Feb 2 2019, 7:13 PM
kib accepted this revision.Feb 2 2019, 8:01 PM
kib added inline comments.
3178 ↗(On Diff #53544)

I think it would be useful to assert that the page passed to vm_pgbatch* is managed.

This revision is now accepted and ready to land.Feb 2 2019, 8:01 PM
markj marked an inline comment as done.Feb 3 2019, 6:10 PM
markj updated this revision to Diff 53562.
  • Assert that we don't batch operations on unmanaged pages.
  • Reword a comment.
This revision now requires review to proceed.Feb 3 2019, 6:10 PM
This revision was not accepted when it landed; it landed in state Needs Review.Feb 3 2019, 6:43 PM
This revision was automatically updated to reflect the committed changes.