Page MenuHomeFreeBSD

kern_malloc: fold free and zfree together into one __always_inline func
ClosedPublic

Authored by bz on Jul 24 2024, 3:59 PM.
Tags
None
Referenced Files
F131756797: D46101.diff
Fri, Oct 10, 10:27 PM
Unknown Object (File)
Thu, Oct 9, 3:06 AM
Unknown Object (File)
Tue, Oct 7, 3:06 AM
Unknown Object (File)
Wed, Sep 24, 8:35 PM
Unknown Object (File)
Tue, Sep 23, 9:47 PM
Unknown Object (File)
Thu, Sep 18, 4:52 PM
Unknown Object (File)
Thu, Sep 18, 4:52 PM
Unknown Object (File)
Sat, Sep 13, 2:57 PM
Subscribers

Details

Summary

free() and zfree() are essentially the same copy and pasted code with
the extra explicit_bzero() (and kasan) calls. Add a bool to add the
extra functionality and make both functions a wrapper around the common
code and let the compiler do the optimization based on the bool input
when inlining.

No functional changes intended.

Suggested by: kib (in D45812)
Sponsored by: The FreeBSD Foundation
MFC after: 10 days

Diff Detail

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

Event Timeline

bz requested review of this revision.Jul 24 2024, 3:59 PM
kib added inline comments.
sys/kern/kern_malloc.c
941
This revision is now accepted and ready to land.Jul 24 2024, 4:19 PM
bz marked an inline comment as done.Jul 24 2024, 4:20 PM

Done locally.

This revision now requires review to proceed.Jul 24 2024, 4:23 PM
sys/kern/kern_malloc.c
950

Hmm, I'm not sure why I put these kasan_mark() calls in zfree(), but they are unnecessary and can be removed.

Remove kasan_mark calls as per @markj

bz marked an inline comment as done.Jul 25 2024, 12:56 PM
This revision is now accepted and ready to land.Jul 25 2024, 12:56 PM