Have vm_page_grab_pages() support VM_ALLOC_NOWAIT
ClosedPublic

Authored by markj on Thu, Aug 10, 1:22 AM.

Details

Summary

The return value now gives the number of pages (starting at the
requested pindex) returned. This lets sendfile() use vm_page_grab_pages(),
which is marginally more cache-friendly.

Test Plan

I tried this patch with a simple benchmark that uses an AF_UNIX
stream socket pair to simulate a sendfile() to /dev/null. Throughput
goes up by about 1.5% when sending a large (8GB) memory-resident
file.

Edit: I had previous claimed a larger improvement, but had accidentally
been testing with the patch from D11943 applied as well.

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.
markj created this revision.Thu, Aug 10, 1:22 AM
markj edited the summary of this revision. (Show Details)Thu, Aug 10, 1:30 AM
markj added reviewers: alc, glebius, kib.
alc accepted this revision.Thu, Aug 10, 3:49 PM
alc added inline comments.
sys/vm/vm_page.c
3181 ↗(On Diff #31839)

I would suggest the phrase "partial prefix". I think it conveys more information.

This revision has a positive review.Thu, Aug 10, 3:49 PM
alc added a comment.Thu, Aug 10, 6:42 PM

Brett, I added you to this change, because it will decrease the time spent in vm_radix_lookup() by your shm_open()/sendfile() test case.

markj updated this revision to Diff 31903.Thu, Aug 10, 9:13 PM
  • Clarify the vm_page_grab_pages() comment.
This revision now requires review to proceed.Thu, Aug 10, 9:13 PM
markj marked an inline comment as done.Thu, Aug 10, 9:13 PM
markj edited the test plan for this revision. (Show Details)Fri, Aug 11, 5:23 AM
kib accepted this revision.Fri, Aug 11, 11:37 AM
This revision has a positive review.Fri, Aug 11, 11:37 AM
markj edited the test plan for this revision. (Show Details)Fri, Aug 11, 3:37 PM
This revision was automatically updated to reflect the committed changes.