Skip to content
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

perf: use spdk mempool per-core cache for io objects pool #1612

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions io-engine/src/core/mempool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use spdk_rs::libspdk::{
spdk_mempool_free,
spdk_mempool_get,
spdk_mempool_put,
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
};

use crate::ffihelper::IntoCString;
Expand All @@ -28,7 +29,9 @@ unsafe impl<T: Sized> Send for MemoryPool<T> {}
unsafe impl<T: Sized> Sync for MemoryPool<T> {}

impl<T: Sized> MemoryPool<T> {
/// Create memory pool with given name and size.
/// Create memory pool with given name, size and per-core cache size.
/// Providing default cache size selects a suitable default in spdk.
/// For mayastor, it'll get set to 512(max allowed).
pub fn create(name: &str, size: u64) -> Option<Self> {
let cname = name.into_cstring();

Expand All @@ -37,7 +40,7 @@ impl<T: Sized> MemoryPool<T> {
cname.as_ptr(),
size,
size_of::<T>() as u64,
0,
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE as u64,
-1,
)
};
Expand Down
Loading