Page MenuHomeFreeBSD

LinuxKPI: switch mallocarray to an lpi implementation using __kmalloc()
Needs RevisionPublic

Authored by bz on Sep 12 2024, 6:27 PM.
Tags
None
Referenced Files
F106975027: D46657.id.diff
Wed, Jan 8, 8:57 AM
F106975006: D46657.id143296.diff
Wed, Jan 8, 8:57 AM
F106975005: D46657.id143291.diff
Wed, Jan 8, 8:57 AM
F106967935: D46657.diff
Wed, Jan 8, 5:55 AM
Unknown Object (File)
Mon, Dec 16, 11:51 PM
Unknown Object (File)
Nov 20 2024, 11:32 AM
Unknown Object (File)
Nov 11 2024, 6:55 PM
Unknown Object (File)
Nov 11 2024, 6:39 PM
Subscribers

Details

Reviewers
jhb
manu
Group Reviewers
linuxkpi
Summary

With mallocarray() we cannot guarantee that any size larger than
PAGE_SIZE will be contiguous. Switch to use the internal __kmalloc()
implementation which now does provide that guarantee.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 59469
Build 56356: arc lint + arc unit

Event Timeline

bz requested review of this revision.Sep 12 2024, 6:27 PM

Also change the (internal) mallocarray() calls in linux_compat.c to lkpi_mallocarray()
given we are using the LinuxKPI malloc type (M_KMALLOC) there already; better for
consistency.

manu requested changes to this revision.Tue, Jan 7, 8:01 PM
manu added a subscriber: manu.

I'm not a fan of this, mallocarray is a OpenBSD thing, not a Linux thing, I don't see why we should have an lkpi implementation.

This revision now requires changes to proceed.Tue, Jan 7, 8:01 PM

It's a helper function; because we do use mallocarray internally and it doesn't go by Linux guarantees on memory being physically contiguous in some cases. I can replace all the mallocarray calls directly with __kmalloc() but that just makes it harder to maintain in many places rather one. We can name this whatever we want it to be if you do not like the name...