Tlsf align overhead reduction#422
Conversation
…rhead For align >= GRANULARITY, if the gap between the chosen free block start and aligned_payload - GRANULARITY is >= GRANULARITY, carve it into a standalone free block L and relocate the used block header to U_start = aligned_payload - GRANULARITY. Result: 4K-aligned 4K alloc retains ~4K+GRANULARITY instead of ~8K. L is an ordinary free block; free/reallocate/coalescing are unchanged. Also adds #[cfg(test)] unit tests with a physical-chain integrity checker. Divergence from upstream rlsf (MIT, yvt) is documented in block.rs.
- carve_leading_free_block: read prev_phys before aliasing write (Critical #1) - carve_leading_free_block: use addr_of_mut! for U.prev_phys to avoid UB (Critical #2) - allocate: remove spurious mut from next_phys_block (Minor vivoblueos#9) - allocate: add comment explaining new_size <= search_size after reclamation (Important vivoblueos#7) - with_pool: assert pool_len > 0 + improve safety comment (Important vivoblueos#11 + vivoblueos#6) - test_aligned_4k_reclaims_gap: add follow-up alloc to verify L is in free list (Important vivoblueos#5) - test_aligned_minimum_gap: new test for l_size == GRANULARITY boundary (Important vivoblueos#8)
cede726 to
eb83eaf
Compare
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/27002826313. |
|
❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/kernel/actions/runs/27002826313. |
|
build_prs |
|
Job is started, see https://github.com/vivoblueos/kernel/actions/runs/27003660272. |
|
Two reasons block.rs doesn't need code changes:
This function computes the search size — how large a free block to look for. After reclamation, we still need to find a block of that size because the gap must physically exist before we can carve it. The search size is a mathematical floor, not the retained size. Changing it would break the allocator.
For align >= GRANULARITY, it reads the UsedBlockPad pointer stored immediately before the payload. After reclamation: U_start = aligned_payload - GRANULARITY So block.rs needed only a comment update (provenance note), not a code change. |
|
✅ All jobs completed successfully, see https://github.com/vivoblueos/kernel/actions/runs/27003660272. |
Uh oh!
There was an error while loading. Please reload this page.