feat(driver): buffer pool allocator#854
Merged
Berrysoft merged 1 commit intoApr 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a pluggable buffer-pool allocation mechanism in compio-driver to address performance/alignment issues observed with different global allocators and O_DIRECT (Issue #472). It extracts buffer-pool logic into a dedicated module, adds a BufferAllocator trait with a default implementation, and wires allocator selection through ProactorBuilder.
Changes:
- Added
BufferAllocator+ defaultBoxAllocator, and refactored buffer-pool implementation intocompio-driver/src/buffer_pool.rs. - Extended
ProactorBuilder/Proactorinitialization to carry a buffer allocator selection (buffer_pool_allocator). - Added Unix integration tests using an
mmap-based allocator; updated sys modules to exposeBufControlinternally and adjusted imports/visibility.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| compio-driver/src/buffer_pool.rs | New buffer-pool module, allocator trait/default, and pool/ref implementation. |
| compio-driver/src/lib.rs | Builder + proactor changes to store/configure the buffer pool allocator and re-export API. |
| compio-driver/src/sys/mod.rs | Adjusted sys module exports to align with moved buffer-pool code. |
| compio-driver/src/sys/buffer_pool.rs | Refactored sys-side buffer control wrapper and fallback module visibility. |
| compio-driver/src/sys/iour/buffer_pool.rs | Updated imports/visibility for BufControl to match new module layout. |
| compio-driver/src/sys/fusion/mod.rs | Adjusted BufControl re-export visibility. |
| compio-driver/src/sys/fusion/buffer_pool.rs | Updated imports/visibility for fusion BufControl. |
| compio-driver/tests/buffer_pool.rs | Added integration tests for buffer pool behavior and an mmap allocator. |
| compio-driver/Cargo.toml | Added nix dev-dependency for mman and configured the new test target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f3c7af8 to
119c3e8
Compare
e649b25 to
985ae6a
Compare
985ae6a to
762ab1c
Compare
Berrysoft
approved these changes
Apr 10, 2026
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.
Closes #472
cc @inklesspen1rus
Added buffer pool trait and default implementation, moved platform-agnostic part of the buffer pool into root level of driver, and added some tests.
Maybe in future we can also add an mmap implementation based on the test, and use
VirtualAllocon windows, what do you think @Berrysoft?