Page MenuHomeFreeBSD

Slightly simplify page queue code.
ClosedPublic

Authored by markj on Tue, Aug 20, 2:36 PM.

Details

Summary
  • Add vm_pagequeue_remove(), which updates page queue state as required when removing a page.
  • Get rid of vm_page_pagequeue_lockptr(). When I added it I planned to use it more widely, but it is only used in vm_page_dequeue(). Modify vm_page_pagequeue() to handle a queue index of PQ_NONE, and use it instead. Make it local to vm_page.c; there are no external consumers and page queue management should be limited to vm_page.c and vm_pageout.c.

No functional change intended.

Diff Detail

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

Event Timeline

markj created this revision.Tue, Aug 20, 2:36 PM
alc added inline comments.Tue, Aug 20, 3:12 PM
sys/vm/vm_page.c
3342 ↗(On Diff #61044)

I'm not sure that I see the point of this assignment or the variable pq1, since the very first statement within this loop will replace the value assigned here.

markj updated this revision to Diff 61046.Tue, Aug 20, 3:21 PM
  • Remove pq1.
  • Fix an assertion added in r338276. I meant to assert that either the page lock is held or that vm_page_dequeue() is being called from the page allocator. But testing m->order is not right, we have m->order == VM_NFREEORDER for any allocated page, so the assertion didn't really test anything.
markj updated this revision to Diff 61055.Tue, Aug 20, 4:46 PM

Re-add pq1, and reload the page queue pointer only once if a mismatch
is detected after locking the page queue.

kib accepted this revision.Tue, Aug 20, 7:23 PM
This revision is now accepted and ready to land.Tue, Aug 20, 7:23 PM
This revision was automatically updated to reflect the committed changes.