Page MenuHomeFreeBSD

Implement fast path for malloc and free
AbandonedPublic

Authored by mjg on Jun 10 2018, 1:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Feb 28, 3:54 PM
Unknown Object (File)
Thu, Feb 27, 2:22 PM
Unknown Object (File)
Mon, Feb 24, 4:49 PM
Unknown Object (File)
Sat, Feb 22, 3:57 AM
Unknown Object (File)
Wed, Feb 19, 11:18 PM
Unknown Object (File)
Feb 8 2025, 7:35 AM
Unknown Object (File)
Jan 31 2025, 12:20 PM
Unknown Object (File)
Jan 30 2025, 6:56 AM
Subscribers

Details

Reviewers
jeff
markj
Summary

Avoids func calls and branches in the common case.

malloc+free throughput per second: ~19323918 to ~27418181.

lock1 from will-it-scale (single-threaded): 2196902 -> 2345506

Test Plan

make universe. running with DEBUG_REDZONE and DEBUG_MEMGUARD

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Does this not include the malloc.h changes for M_ZERO?

Can we do constant size at the same time?

sys/kern/kern_malloc.c
656–662

This should be a uma_int.h inline.

867–871

Should also be an inline. Possibly with some of the code above.

The M_ZERO stuff went in quite some time ago.

I plan to deal with static one lookup later.

I don't think the inlined cache bump matters. But if you insist i can move it to a dedicated routine.

mjg planned changes to this revision.Aug 31 2019, 9:50 AM

Apart from addressing this review request this needs some reworking due to other changes in uma.