Skip to content

Lower the async task slab allocation to 1000 bytes. #38727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2021

Conversation

DougGregor
Copy link
Member

Due to malloc quanta rounding, 1024-byte async task allocation slabs
actually end up allocating 1536 bytes on Darwin. Instead, use 1000-byte
slabs.

Fixes rdar://81181856.

Due to malloc quanta rounding, 1024-byte async task allocation slabs
actually end up allocating 1536 bytes on Darwin. Instead, use 1000-byte
slabs.

Fixes rdar://81181856.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

///
/// TODO: find the optimal value by experiment.
static constexpr size_t SlabCapacity = 1024;
static constexpr size_t SlabCapacity = 1000;
Copy link
Contributor

Choose a reason for hiding this comment

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

The way we make this a template argument is unfortunate, because it means we have to write it out here where we can't adjust it for the slab header size, which is what we obviously should be doing instead of this magic-number adjustment.

It should probably also be smaller on 32-bit platforms.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we could change the semantics of the template argument so that it's the requested malloc size instead of the requested slab size.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. Let's separate out a task to make this more robust in the future.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test Linux

@DougGregor DougGregor merged commit a51b650 into swiftlang:main Aug 3, 2021
@DougGregor DougGregor deleted the async-task-slab-quanta branch August 3, 2021 07:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants