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)
Feb 23 2024, 11:08 AM
Unknown Object (File)
Feb 23 2024, 11:07 AM
Unknown Object (File)
Feb 23 2024, 11:07 AM
Unknown Object (File)
Feb 23 2024, 11:07 AM
Unknown Object (File)
Feb 23 2024, 10:54 AM
Unknown Object (File)
Dec 23 2023, 12:12 AM
Unknown Object (File)
Dec 20 2023, 11:40 AM
Unknown Object (File)
Nov 18 2023, 10:14 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mjg requested review of this revision.Nov 5 2020, 1:37 PM
sys/sys/malloc.h
118 ↗(On Diff #79210)

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

143 ↗(On Diff #79210)

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

sys/sys/malloc.h
118 ↗(On Diff #79210)

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 ↗(On Diff #79210)

will do

  • use modern initialisers for MALLOC_DEFINE

Don't forget to bump __FreeBSD_version.

sys/sys/malloc.h
118 ↗(On Diff #79210)

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.