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
Unknown Object (File)
Sun, Jun 29, 5:40 PM
Unknown Object (File)
Sat, Jun 28, 5:23 AM
Unknown Object (File)
Tue, Jun 24, 5:51 PM
Unknown Object (File)
Tue, Jun 24, 12:11 AM
Unknown Object (File)
Sat, Jun 21, 11:58 PM
Unknown Object (File)
Sat, Jun 21, 10:36 PM
Unknown Object (File)
Wed, Jun 18, 9:23 PM
Unknown Object (File)
Wed, Jun 18, 11:22 AM
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

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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