Page MenuHomeFreeBSD

vm_page: Teach vm_page_grab_pages to batch page allocations
Needs ReviewPublic

Authored by bnovkov on Oct 10 2024, 9:39 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Aug 4, 4:38 AM
Unknown Object (File)
Mon, Aug 3, 2:42 AM
Unknown Object (File)
Sun, Jul 26, 3:38 PM
Unknown Object (File)
Sat, Jul 25, 5:02 PM
Unknown Object (File)
Wed, Jul 22, 6:46 PM
Unknown Object (File)
Tue, Jul 21, 7:12 AM
Unknown Object (File)
Sun, Jul 19, 4:15 PM
Unknown Object (File)
Jul 5 2026, 6:24 AM
Subscribers

Details

Reviewers
markj
alc
kib
Summary

This change modifies vm_page_grab_pages to use vm_page_alloc_pages.
Instead of allocating and inserting one page at a time,
vm_page_grab_pages will now inspect the object's memq or the radix
tree to determine how many pages can be allocated from the
current offset and allocate them using vm_page_alloc_pages.

Tested by: gallatin

Test Plan

All changes have been stress-tested and performance-tested using sendfile.
@gallatin has tested the entire patch series on a machine with the following specs:
Xeon E5-2697A v4 @ 2.60GHz, 1x Mellanox ConnectX4 100GbE, 4x nvme, 128GB DDR4-2400
The results showed a 3.5% reduction in CPU usage when serving Netflix video traffic.

I've also evaluated vm_page_alloc_pages using a simple microbenchmark that allocates
N pages at a time and compared it to the common 'vm_page_alloc_page + forloop' approach.
The plotted results are available at https://people.freebsd.org/~bnovkov/plots/batch_alloc_plot.png

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 59897
Build 56782: arc lint + arc unit