HomeFreeBSD

LinuxKPI: switch mallocarray to an lkpi implementation using __kmalloc()

Description

LinuxKPI: switch mallocarray to an lkpi implementation using __kmalloc()

With mallocarray() we cannot guarantee that any size larger than
PAGE_SIZE will be contiguous. Switch kmalloc_array() and
kmalloc_array_node() to use kmalloc()/lkpi_kmalloc_node() as their
underlying implementation which now does provide that guarantee.
Likewise adjust kcalloc_node() to use kmalloc_array_node().
This means we only have two (plain + _node) underlying allocation
routines for the entire category of functions.

Also adjust kvmalloc() and kvmalloc_array() to be a "mirrored"
implementation to their non-v counterparts. These may return
non-contiguous memory so can use malloc().

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: jhb
Extra thanks to: jhb for helping sorting this out
Differential Revision: https://reviews.freebsd.org/D46657

Details

Provenance
bzAuthored on Mar 20 2025, 11:54 PM
Reviewer
jhb
Differential Revision
D46657: LinuxKPI: switch mallocarray to an lpi implementation using __kmalloc()
Parents
rG4359672e656a: LinuxKPI: add seq_hex_dump()
Branches
Unknown
Tags
Unknown