Skip to content

Fix computation of minimum fragment size #539

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
Apr 2, 2025

Conversation

madmajestro
Copy link
Contributor

The minimum fragment size previously used by the sma layer was too small. This could lead to the unnecessary creation of small free blocks that could not be used for any allocation. To keep separation of layers, the minimum size is now passed to apc_sma_init().

@madmajestro
Copy link
Contributor Author

The fragment size previously used by the sma layer to decide whether to split a block was 80 bytes (MINBLOCKSIZE + Fragment), even though the smallest possible cache entry requires a contiguous block of 160 bytes (using apcu_store("", 1)).

This could result in small free blocks that could never be allocated and had to be checked with each call to find_block().

The minimum allocation size previously used by the sma layer was too
small. This could lead to small free blocks that could not be used for
any allocation. To keep separation of layers, the expected minimum
allocation size is now passed to apc_sma_init().
Copy link
Collaborator

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Nice!

@nikic nikic merged commit 426ac32 into krakjoe:master Apr 2, 2025
31 checks passed
@madmajestro madmajestro deleted the fragment-size branch April 2, 2025 12:08
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.

2 participants