opnsense-src/sys/compat/linuxkpi
Olivier Certner 88a7dd1118 LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc()
Since commit 19df0c5abcb9d4e9 ("LinuxKPI: make __kmalloc() play by the
rules"), kmalloc() systematically allocates contiguous physical memory,
as it should.  However, kvzalloc() was left defined in terms of
kmalloc(), which makes it allocate contiguous physical memory too.  This
is a too stringent restriction, as kvzalloc() is supposed to be a simple
page-zeroing wrapper around kvmalloc().

According to Linux's documentation ("memory-allocation.rst"), kvmalloc()
first tries to allocate contiguous memory, falling back to
non-contiguous one if that fails.  Thus, callers are already supposed to
deal with the possibility of non-contiguous memory being returned.

Reviewed by:    bz
Fixes:          19df0c5abcb9 ("LinuxKPI: make __kmalloc() play by the rules")
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51247

(cherry picked from commit 986edb19a49c7d7d3050c759d9b0826283492ebf)

Forgotten on commit to main/-CURRENT:
PR:             277476
2025-07-31 12:43:10 +02:00
..
common LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() 2025-07-31 12:43:10 +02:00
dummy/include LinuxKPI: dummy: add more dummy hreader files 2025-07-16 08:48:15 +02:00