Page MenuHomeFreeBSD

LinuxKPI: always use contig allocations in linux_alloc_kmem()
ClosedPublic

Authored by bz on Sep 12 2024, 9:25 PM.
Tags
None
Referenced Files
F112753965: D46661.id.diff
Sat, Mar 22, 8:42 AM
Unknown Object (File)
Fri, Mar 14, 4:27 PM
Unknown Object (File)
Feb 3 2025, 4:11 AM
Unknown Object (File)
Feb 1 2025, 10:03 PM
Unknown Object (File)
Feb 1 2025, 6:47 PM
Unknown Object (File)
Jan 30 2025, 5:29 PM
Unknown Object (File)
Jan 27 2025, 11:45 PM
Unknown Object (File)
Jan 20 2025, 9:39 AM

Details

Summary

In linux_alloc_kmem() [used by *get_page*()] we always at least allocate
PAGE_SIZE and we want the allocation to be contiguous so it can be passed
to DMA. Always use kmem_alloc_contig() and only change the low argument
depending on the GFP_DMA32 flag being given or not.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

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

Event Timeline

bz requested review of this revision.Sep 12 2024, 9:25 PM

I just built a kernel with this patch and will use it starting from tomorrow.

The documentation is not entirely clear, but both core-api/dma-api-howto.rst and kernel-hacking/hacking.rst do imply that these functions allocate contiguous memory. Also, the PMAP_HAS_DMAP version in the caller of this function is careful to allocate contiguous memory always.

This revision is now accepted and ready to land.Jan 29 2025, 9:42 PM

After three days of using it, I didn’t see any regressions.