Page MenuHomeFreeBSD

LinuxKPI: Have kvzalloc() rely on kvmalloc(), not kmalloc()
ClosedPublic

Authored by olce on Fri, Jul 11, 6:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Aug 3, 12:01 AM
Unknown Object (File)
Tue, Jul 29, 4:52 AM
Unknown Object (File)
Tue, Jul 29, 2:56 AM
Unknown Object (File)
Tue, Jul 29, 2:52 AM
Unknown Object (File)
Tue, Jul 29, 1:48 AM
Unknown Object (File)
Tue, Jul 29, 12:21 AM
Unknown Object (File)
Mon, Jul 28, 6:50 PM
Unknown Object (File)
Sun, Jul 27, 11:14 AM
Subscribers

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable