Conversation
This embeds a block_null sentinel in tlsf_t so all empty free-list bin pointers point to the sentinel instead of NULL, removing three data-dependent branches on the hot path: two in remove_free_block (prev/next NULL checks) and one in insert_free_block (current NULL check), replacing them with unconditional writes that are harmless when they hit the sentinel. Both initialization paths are covered: tlsf_pool_init sets all bin pointers to &block_null after memset, and arena_grow does so lazily on first use of a dynamic pool (before any free-list operation).
WCET Results (x86-64) |
WCET Results (arm64) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This embeds a block_null sentinel in tlsf_t so all empty free-list bin pointers point to the sentinel instead of NULL, removing three data-dependent branches on the hot path: two in remove_free_block (prev/next NULL checks) and one in insert_free_block (current NULL check), replacing them with unconditional writes that are harmless when they hit the sentinel.
Both initialization paths are covered: tlsf_pool_init sets all bin pointers to &block_null after memset, and arena_grow does so lazily on first use of a dynamic pool (before any free-list operation).
Summary by cubic
Embed a free-list sentinel (block_null) in tlsf_t so empty bins point to it, removing NULL checks in the hot path. This drops three data-dependent branches and replaces them with safe unconditional writes.
Written for commit 207b645. Summary will update on new commits.