HomeFreeBSD

x86/busdma: Limit reserved pages if low nsegs

Description

x86/busdma: Limit reserved pages if low nsegs

When bus_dmamap_create is called, if bouncing might be required we
reserve enough pages for a maximum-length request, subject to the
MAX_BPAGES constraint (32 MB on amd64; 32 MB or 2 MB on i386
depending on the amount of RAM).

Since pages used for bouncing are typically non-consecutive, each
bounced page will typically constitute a busdma segment; as such, we
are unlikely to ever successfully use more pages than the nsegments
limit. Limit the number of pages reserved to nsegments.

On FreeBSD/Firecracker, this reduces bounce page memory consumption
from 32 MB to 512 kB, making VMs with 128 MB of RAM usable.

Reviewed by: imp, mav
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D37082

Details

Provenance
cpercivaAuthored on Oct 21 2022, 6:13 PM
Reviewer
imp
Differential Revision
D37082: x86/busdma: Limit reserved pages if low nsegs
Parents
rGf585d13dd60b: rtld: remove unused macro FPTR_TARGET
Branches
Unknown
Tags
Unknown