Skip to content

feat(driver): buffer pool allocator#854

Merged
Berrysoft merged 1 commit into
compio-rs:masterfrom
George-Miao:feat/driver/buffer-pool-alloc
Apr 10, 2026
Merged

feat(driver): buffer pool allocator#854
Berrysoft merged 1 commit into
compio-rs:masterfrom
George-Miao:feat/driver/buffer-pool-alloc

Conversation

@George-Miao
Copy link
Copy Markdown
Member

@George-Miao George-Miao commented Apr 10, 2026

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 VirtualAlloc on windows, what do you think @Berrysoft?

Copilot AI review requested due to automatic review settings April 10, 2026 03:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 + default BoxAllocator, and refactored buffer-pool implementation into compio-driver/src/buffer_pool.rs.
  • Extended ProactorBuilder/Proactor initialization to carry a buffer allocator selection (buffer_pool_allocator).
  • Added Unix integration tests using an mmap-based allocator; updated sys modules to expose BufControl internally 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.

Comment thread compio-driver/src/buffer_pool.rs Outdated
Comment thread compio-driver/src/buffer_pool.rs Outdated
Comment thread compio-driver/src/buffer_pool.rs Outdated
Comment thread compio-driver/tests/buffer_pool.rs
@George-Miao George-Miao force-pushed the feat/driver/buffer-pool-alloc branch 2 times, most recently from f3c7af8 to 119c3e8 Compare April 10, 2026 03:25
@George-Miao George-Miao self-assigned this Apr 10, 2026
@George-Miao George-Miao added enhancement New feature or request package: driver Related to compio-driver labels Apr 10, 2026
@George-Miao George-Miao requested a review from Berrysoft April 10, 2026 03:25
@George-Miao George-Miao force-pushed the feat/driver/buffer-pool-alloc branch 3 times, most recently from e649b25 to 985ae6a Compare April 10, 2026 03:38
@George-Miao George-Miao force-pushed the feat/driver/buffer-pool-alloc branch from 985ae6a to 762ab1c Compare April 10, 2026 03:54
@Berrysoft Berrysoft added this pull request to the merge queue Apr 10, 2026
Merged via the queue into compio-rs:master with commit 9143e8a Apr 10, 2026
68 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 9, 2026
@George-Miao George-Miao deleted the feat/driver/buffer-pool-alloc branch April 10, 2026 12:24
This was referenced Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request package: driver Related to compio-driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unstable File's AsyncManagedReadAt performance when changing global allocator

3 participants