Page MenuHomeFreeBSD

malloc: move malloc_type_internal into malloc_type
ClosedPublic

Authored by mjg on Nov 5 2020, 1:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 8 2024, 2:10 AM
Unknown Object (File)
Sep 18 2024, 4:42 AM
Unknown Object (File)
Sep 18 2024, 2:36 AM
Unknown Object (File)
Sep 8 2024, 11:58 AM
Unknown Object (File)
Sep 4 2024, 5:38 PM
Unknown Object (File)
Sep 4 2024, 12:02 PM
Unknown Object (File)
Sep 4 2024, 12:02 PM
Unknown Object (File)
Sep 4 2024, 12:01 PM
Subscribers

Details

Summary

According to code comments the original motivation was to allow for malloc_type_internal changes without ABI breakage. This can be trivially accomplished by providing spare fields and versioning the struct, as implemented in the patch below.

The upshots are one less memory indirection on each alloc and disappearance of mt_zone.

Test Plan

Booted, vmstat -M /dev/mem -m and vmstat -m agree.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

mjg requested review of this revision.Nov 5 2020, 1:37 PM
sys/sys/malloc.h
118

What's the purpose of having two structures with the same visibility?

143–148

Would be nice to convert to C99 initializers while you're here.

sys/sys/malloc.h
118

It's less churn vs the current code and I like some level of logical separation still provided. Regardless, if you insist, I fold the content into the malloc_type itself.

143–148

will do

  • use modern initialisers for MALLOC_DEFINE

Don't forget to bump __FreeBSD_version.

sys/sys/malloc.h
118

Mos

This revision is now accepted and ready to land.Nov 6 2020, 9:16 PM
This revision was automatically updated to reflect the committed changes.