Page MenuHomeFreeBSD

vm_object: use lookup_range in vm_object_page_clean_flush
ClosedPublic

Authored by dougm on May 20 2025, 7:32 AM.
Tags
None
Referenced Files
F141043949: D50425.id155726.diff
Wed, Dec 31, 3:25 AM
Unknown Object (File)
Fri, Dec 5, 5:35 PM
Unknown Object (File)
Nov 29 2025, 7:59 AM
Unknown Object (File)
Nov 25 2025, 5:02 PM
Unknown Object (File)
Nov 11 2025, 9:46 PM
Unknown Object (File)
Nov 11 2025, 1:48 AM
Unknown Object (File)
Nov 10 2025, 12:47 AM
Unknown Object (File)
Nov 3 2025, 10:40 PM
Subscribers

Details

Summary

In vm_object_page_clean_flush and vm_pageout_cluster, replace the loop that uses vm_radix_iter_next to visit consecutive pages with a call to
vm_radix_iter_lookup_range, then a loop to check the pages.

Test Plan

I tested by running several buildworlds while I counted function calls and cycles spent per call (not counting the time in vm_pageout_flush).

Original:

Calls    Cycles/call
27929    2974.9316839127787
27929    2983.8554549035052
27928    2993.4640146089946

Modified:

Calls    Cycles/call
27929    2863.995273729815
27928    2908.8322114007447
27930    2899.870032223416

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

dougm requested review of this revision.May 20 2025, 7:32 AM
dougm created this revision.
sys/vm/vm_object.c
1143–1144

From what I can see, pctrie_iter_lookup_range() doesn't update the iterator index. Is that correct? If so, how do we know what "prev" is relative to?

sys/vm/vm_object.c
1143–1144

That is correct.

"prev" is relative to where the cursor pointed when the function was called, which is the same place that "next" is relative to now - the pindex of the page passed into the function.

BTW, I hope to replace the "prev" parts with a backward-walking version of lookup_range, but it' s too much to put in this patch I think, and it needs more work.

dougm retitled this revision from vm_pageout: use lookup_range before pageout_flush to vm_object: use lookup_range in vm_object_page_clean_flush .
dougm edited the summary of this revision. (Show Details)
dougm edited the test plan for this revision. (Show Details)

Limit the changes to just vm_object_page_clean_flush. Provide more meaningful performance results.

This revision is now accepted and ready to land.May 28 2025, 5:31 AM