Page MenuHomeFreeBSD

vmm/vmm_mem.c: Use a custom 'pgo_populate' operation for sysmem segments
Needs ReviewPublic

Authored by bnovkov on Thu, Oct 15, 6:21 PM.
Tags
None
Referenced Files
F176346049: D60752.diff
Sun, Oct 18, 2:33 AM
Unknown Object (File)
Fri, Oct 16, 2:29 PM
Unknown Object (File)
Fri, Oct 16, 2:28 PM
Unknown Object (File)
Fri, Oct 16, 9:00 AM
Unknown Object (File)
Fri, Oct 16, 7:37 AM
Unknown Object (File)
Fri, Oct 16, 7:36 AM
Unknown Object (File)
Fri, Oct 16, 4:54 AM
Unknown Object (File)
Fri, Oct 16, 2:17 AM
Subscribers

Details

Reviewers
markj
kib
Summary

This change implements a 'pgo_populate' pager operation for objects
backing system memory segment, allowing the vmm module to take
advantage of the 'vm_fault_wire' fast path. Under this new scheme, each
system memory segment preallocates all pages before they are wired,
using 'vm_reserv_pindex_aligned' to allocate VM_LEVEL_0_ORDER-sized
pages where appropriate.

Test Plan

This change (and the whole patch stack) was tested by measuring how long it takes to wire
a 3GB system memory segment for a bhyve VM on an Intel i3-13100F machine.
I've used the following dtrace snippet to measure this: dtrace -n 'fbt::vm_mmap_memseg:entry { self->ts = timestamp; } fbt::vm_mmap_memseg:return /self->ts/ { printf("%d", (timestamp - self->ts));self->ts = 0 }'.

The results show a massive improvement when compared to the slow path:

x bhyve_wire_patch.txt
+ bhyve_wire_baseline.txt
    N           Min           Max        Median           Avg        Stddev
x  10      22315921      23504339      22437526      22536410      352224.4
+  10  4.789722e+08 4.8494576e+08 4.8042138e+08  4.811004e+08       1686655
Difference at 95.0% confidence
	4.58564e+08 +/- 1.14478e+06
	2034.77% +/- 22.7181%
	(Student's t, pooled s = 1.21837e+06)

bhyve VMs launched with this patch work as expected, both with and without -S flag.
The patch also survived an hour-long stress test with stress2's mlock and vm scripts.

Diff Detail

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