Skip to content

Allocator that just uses malloc and bypasses custom jemalloc/freelist#9108

Merged
cmcfarlen merged 1 commit intoapache:masterfrom
cmcfarlen:malloc-allocator
Oct 11, 2022
Merged

Allocator that just uses malloc and bypasses custom jemalloc/freelist#9108
cmcfarlen merged 1 commit intoapache:masterfrom
cmcfarlen:malloc-allocator

Conversation

@cmcfarlen
Copy link
Contributor

This PR reimplements Allocator to just use malloc/free and completely ignores the ink_freelist code. It doesn't disable ProxyAllocator freelists. This means the -F (proxy allocator disable) works, but -f (disable freelist) does nothing.

This differs from the -f option (when jemalloc is enabled) in the following ways:

  • honors advice and calls (jemalloc's) madvise (for nodump support on io buffers).
  • Does not use the jemallocnodumallocator for aligned allocation, but uses (jemalloc's) aligned_alloc.
  • does not use posix_madvise, or posix_memalign in any case

To use this allocator, one must pass --enable-malloc-allocator to configure otherwise it will behave as it always has.

@cmcfarlen cmcfarlen added this to the 10.0.0 milestone Sep 27, 2022
@bryancall bryancall added the Core label Sep 28, 2022
@duke8253
Copy link
Contributor

duke8253 commented Oct 6, 2022

So if I'm understanding this correct, this is mostly for when jemalloc is around and we don't want to use the nodumpallocator. And if ats isn't built with jemalloc, this behaves the same as passing -f, other than the memalign part.

@cmcfarlen
Copy link
Contributor Author

Yes, this shows a modest performance increase over -f but a huge increase over using ink_freelist* yet still honors madvise. Basically it is totally relying on the malloc implementation to do something performant and allows full tuning to that end.

Since this just uses the standard C memory calls, it would work with mimalloc as well but might have to include the overrides header.

Copy link
Contributor

@duke8253 duke8253 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me.

@cmcfarlen cmcfarlen merged commit 4f4ee2e into apache:master Oct 11, 2022
@cmcfarlen cmcfarlen deleted the malloc-allocator branch October 11, 2022 20:41
SolidWallOfCode pushed a commit to SolidWallOfCode/trafficserver that referenced this pull request Oct 13, 2022
…ists (apache#9108)

Co-authored-by: Chris McFarlen <cmcfarlen@apple.com>
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Sep 26, 2023
…ists (apache#9108)

Co-authored-by: Chris McFarlen <cmcfarlen@apple.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants