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)
Sat, Jun 29, 12:37 AM
Unknown Object (File)
Fri, Jun 28, 10:41 PM
Unknown Object (File)
Thu, Jun 27, 8:07 PM
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
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.