opnsense-src/sys/compat
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
..
freebsd32 stat(2): add st_bsdflags field 2025-04-09 03:53:17 +03:00
ia32 sysentvec: add SV_SIGSYS flag 2023-10-09 06:24:31 +03:00
lindebugfs lindebugfs: use __func__ not __FUNCTION__ 2025-02-10 14:52:12 +00:00
linprocfs linprocfs: Correct sysfs /proc/<pid>/mountinfo entry 2025-03-31 10:42:48 -07:00
linsysfs linsysfs(5): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743 2023-08-18 13:12:02 +03:00
linux linux: Handle IP_RECVTOS cmsg type 2025-03-31 10:43:06 -07:00
linuxkpi LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc() 2025-07-31 12:43:10 +02:00
x86bios sys: Remove $FreeBSD$: one-line .c pattern 2023-08-16 11:54:36 -06:00