Page MenuHomeFreeBSD

vm_pageout: simplify pageout_cluster
ClosedPublic

Authored by dougm on Aug 3 2024, 5:43 AM.
Tags
None
Referenced Files
F95177983: D46217.diff
Thu, Sep 19, 4:52 PM
Unknown Object (File)
Thu, Sep 12, 9:25 PM
Unknown Object (File)
Tue, Sep 3, 1:46 AM
Unknown Object (File)
Mon, Sep 2, 12:01 AM
Unknown Object (File)
Sun, Sep 1, 9:57 PM
Unknown Object (File)
Aug 14 2024, 10:14 AM
Unknown Object (File)
Aug 9 2024, 7:46 AM
Unknown Object (File)
Aug 7 2024, 4:13 AM
Subscribers

Details

Summary

Rewrite vm_pageout_cluster to eliminate redundant variables and duplicated code, without changing its functionality.

Remove tests on pindex to check for object boundary conditions, since the page_next and page_prev functions return NULL at the object boundaries. Fix an alignment error that could happen if pindex is aligned, and the first of vm_pageout_page_count flushable pages, and the page at pindex-1 is also flushable.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.Aug 3 2024, 5:43 AM
dougm created this revision.

For the most part, I am fine with this. Personally, I would prefer to see the NULL check remain in the caller, and I dislike the ok2cluster in vm_pageout_ok2cluster.

Amend to address @alc comments.

Add a comment to explain the ib > pindex test.

sys/vm/vm_pageout.c
394–395

Actually, this test is unnecessary. If ib > pindex, then m->pindex == 0 and vm_page_prev(m) is NULL, so the break will happen anyway.

sys/vm/vm_pageout.c
404–405

The object->size test is unnecessary, since if pindex + is == object->size, vm_page_next(m) will be NULL and terminate the loop.

Better to do that, and set a right_terminated flag before the break.

Then, in the first loop, move the % vm_pageout_page_count test to the top of the loop, but only test it if right_terminated is false.

And replace "ib == 0" with left_terminated ==true, and get rid of ib and is variables.

More changes, to remove needless tests and more variables.

Rewrite the alignment-test expression to make it more readable.

Move the "% vm_pageout_page_count" calculation out of the loop.

Remove a redundant 'num_ends' check from the alignment test.

Undo the last change, since it breaks the case with the first iteration of the forward loop fails.

This revision is now accepted and ready to land.Aug 4 2024, 10:07 AM
This revision was automatically updated to reflect the committed changes.