freebsd-src/sys/arm64/include
Mark Johnston b16b4c22d2 vm_page: Implement lazy page initialization
FreeBSD's boot times have decreased to the point where vm_page array
initialization represents a significant fraction of the total boot time.
For example, when booting FreeBSD in Firecracker (a VMM designed to
support lightweight VMs) with 128MB and 1GB of RAM, vm_page
initialization consumes 9% (3ms) and 37% (21.5ms) of the kernel boot
time, respectively.  This is generally relevant in cloud environments,
where one wants to be able to spin up VMs as quickly as possible.

This patch implements lazy initialization of (most) page structures,
following a suggestion from cperciva@.  The idea is to introduce a new
free pool, VM_FREEPOOL_LAZYINIT, into which all vm_page structures are
initially placed.  For this to work, we need only initialize the first
free page of each chunk placed into the buddy allocator.  Then, early
page allocations draw from the lazy init pool and initialize vm_page
chunks (up to 16MB, 4096 pages) on demand.  Once APs are started, an
idle-priority thread drains the lazy init pool in the background to
avoid introducing extra latency in the allocator.  With this scheme,
almost all of the initialization work is moved out of the critical path.

A couple of vm_phys operations require the pool to be drained before
they can run: vm_phys_find_range() and vm_phys_unfree_page().  However,
these are rare operations.  I believe that
vm_phys_find_freelist_contig() does not require any special treatment,
as it only ever accesses the first page in a power-of-2-sized free page
chunk, which is always initialized.

For now the new pool is only used on amd64 and arm64, since that's where
I can easily test and those platforms would get the most benefit.

Reviewed by:	alc, kib
Differential Revision:	https://reviews.freebsd.org/D40403
2024-06-13 21:19:00 -04:00
..
_align.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
_bus.h _bus.h: Use standard licnese text 2023-11-13 12:25:30 -07:00
_inttypes.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
_limits.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
_stdint.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
_types.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
acle-compat.h arm64 lib32: prepare arm64 headers to redirect to arm 2023-07-25 18:59:26 -05:00
acpica_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
armreg.h arm64: Fix indentation to be consistent 2024-06-10 15:16:10 +00:00
asan.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
asm.h arm64: Add PAC instruction macros 2023-10-20 17:01:05 +01:00
atomic.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bus.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
bus_dma.h arm64: Implement busdma bits for KMSAN 2024-02-08 11:35:11 -05:00
bus_dma_impl.h arm64: Implement busdma bits for KMSAN 2024-02-08 11:35:11 -05:00
clock.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
cmn600_reg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
counter.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
cpu.h am64: Allow cpu.h to be included from assembly 2024-05-10 09:29:24 +00:00
cpufunc.h arm64: Use void pointers for arguments to arm64_get_writable_addr 2024-03-15 10:10:24 -07:00
cpuinfo.h arm64 lib32: prepare arm64 headers to redirect to arm 2023-07-25 18:59:26 -05:00
csan.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
db_machdep.h arm64: Support hardware breakpoints 2024-04-12 09:32:56 +00:00
debug_monitor.h arm64: Support hardware breakpoints 2024-04-12 09:32:56 +00:00
disassem.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
dump.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
efi.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
elf.h arm64: Add more HWCAP2 values 2023-11-10 16:01:13 +00:00
endian.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
exec.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
float.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
floatingpoint.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
fpu.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
frame.h freebsd32: struct siginfo32 -> struct __siginfo32 2024-03-19 23:13:26 +00:00
gdb_machdep.h spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD 2023-05-12 10:44:03 -06:00
hypervisor.h arm64: Add a macro to find a VM fault address 2024-02-21 18:55:32 +00:00
ieeefp.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
ifunc.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
in_cksum.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
intr.h intrng: Extract arm/arm64 IPI->PIC glue code 2024-01-24 23:49:53 +00:00
iodev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
iommu.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
kdb.h arm64: Support hardware breakpoints 2024-04-12 09:32:56 +00:00
machdep.h arm64: Add in_vhe() to find if the kernel is in VHE 2024-02-21 11:26:29 +00:00
md_var.h arm64: Create a Linux view of the ID registers 2023-11-10 16:01:13 +00:00
memdev.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
metadata.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
minidump.h sys: Remove $FreeBSD$: one-line .h pattern 2023-08-16 11:54:18 -06:00
msan.h arm64: Add msan.h 2024-02-08 11:35:11 -05:00
ofw_machdep.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
param.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
pcb.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
pci_cfgreg.h pci_cfgreg: Add a PCI domain argument to the low-level register API 2023-11-29 10:31:47 -08:00
pcpu.h arm64: Delete stale comment 2024-03-27 15:43:38 -04:00
pcpu_aux.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
pmap.h arm64, riscv: removed unused struct pv_addr 2024-05-24 10:55:24 -03:00
pmc_mdep.h pmc: better distinguish pmu-events allocation path 2023-09-03 13:27:21 -07:00
proc.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
procctl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
profile.h arm64: Add a BTI landing pad to .mcount 2023-10-30 17:55:45 +00:00
psl.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
pte.h arm64: set ATTR_CONTIGUOUS on the DMAP's L2 blocks 2024-05-22 22:09:43 -05:00
ptrace.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
reg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
reloc.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
resource.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
runq.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
setjmp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sf_buf.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sigframe.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
signal.h sys: Remove ancient SCCS tags. 2023-11-26 22:23:30 -07:00
smp.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
stack.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
stdarg.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
sysarch.h Add a BTI sysarch 2024-02-22 16:27:47 +00:00
sysreg.h arm64 lib32: prepare arm64 headers to redirect to arm 2023-07-25 18:59:26 -05:00
tls.h arm64 lib32: prepare arm64 headers to redirect to arm 2023-07-25 18:59:26 -05:00
trap.h sys: Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:24 -06:00
ucontext.h arm64: Support passing more registers to signals 2024-03-21 10:13:16 +00:00
undefined.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vdso.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vfp.h arm64: Create a version of vfp_save_state for cpu_switch 2024-06-12 14:09:14 +01:00
vm.h sys: Remove $FreeBSD$: two-line .h pattern 2023-08-16 11:54:11 -06:00
vmm.h arm64/vmm: Add breakpoint and single-stepping support 2024-06-04 14:58:08 -04:00
vmm_dev.h Import the kernel parts of bhyve/arm64 2024-02-21 18:55:32 +00:00
vmm_instruction_emul.h Import the kernel parts of bhyve/arm64 2024-02-21 18:55:32 +00:00
vmm_snapshot.h Import the kernel parts of bhyve/arm64 2024-02-21 18:55:32 +00:00
vmparam.h vm_page: Implement lazy page initialization 2024-06-13 21:19:00 -04:00