env: Add a default value for mempool cache size
This is just a convenience and replaces the common practice of passing -1. Change-Id: Id96734307ebf52ef0ee7dba0e7ac89602b2b5b1a Signed-off-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/374520 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
0d3a55b79e
commit
053d5733e6
@ -31,6 +31,13 @@ The NVMe driver now recognizes the NVMe 1.3 Namespace Optimal I/O Boundary field
|
|||||||
NVMe 1.3 devices may report an optimal I/O boundary, which the driver will take
|
NVMe 1.3 devices may report an optimal I/O boundary, which the driver will take
|
||||||
into account when splitting I/O requests.
|
into account when splitting I/O requests.
|
||||||
|
|
||||||
|
### Environment Abstraction Layer
|
||||||
|
|
||||||
|
A new default value, SPDK_MEMPOOL_DEFAULT_CACHE_SIZE, was added to provide
|
||||||
|
additional clarity when constructing spdk_mempools. Previously, -1 could be
|
||||||
|
passed and the library would choose a reasonable default, but this new value
|
||||||
|
makes it explicit that the default is being used.
|
||||||
|
|
||||||
## v17.07: Build system improvements, userspace vhost-blk target, and GPT bdev
|
## v17.07: Build system improvements, userspace vhost-blk target, and GPT bdev
|
||||||
|
|
||||||
### Build System
|
### Build System
|
||||||
|
@ -468,9 +468,11 @@ associate_workers_with_chan(void)
|
|||||||
t->ioat_chan_id = i;
|
t->ioat_chan_id = i;
|
||||||
snprintf(buf_pool_name, sizeof(buf_pool_name), "buf_pool_%d", i);
|
snprintf(buf_pool_name, sizeof(buf_pool_name), "buf_pool_%d", i);
|
||||||
snprintf(task_pool_name, sizeof(task_pool_name), "task_pool_%d", i);
|
snprintf(task_pool_name, sizeof(task_pool_name), "task_pool_%d", i);
|
||||||
t->data_pool = spdk_mempool_create(buf_pool_name, 512, g_user_config.xfer_size_bytes, -1,
|
t->data_pool = spdk_mempool_create(buf_pool_name, 512, g_user_config.xfer_size_bytes,
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
SPDK_ENV_SOCKET_ID_ANY);
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
t->task_pool = spdk_mempool_create(task_pool_name, 512, sizeof(struct ioat_task), -1,
|
t->task_pool = spdk_mempool_create(task_pool_name, 512, sizeof(struct ioat_task),
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
SPDK_ENV_SOCKET_ID_ANY);
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
if (!t->data_pool || !t->task_pool) {
|
if (!t->data_pool || !t->task_pool) {
|
||||||
fprintf(stderr, "Could not allocate buffer pool.\n");
|
fprintf(stderr, "Could not allocate buffer pool.\n");
|
||||||
|
@ -332,10 +332,13 @@ work_fn(void *arg)
|
|||||||
|
|
||||||
snprintf(buf_pool_name, sizeof(buf_pool_name), "buf_pool_%d", rte_lcore_id());
|
snprintf(buf_pool_name, sizeof(buf_pool_name), "buf_pool_%d", rte_lcore_id());
|
||||||
snprintf(task_pool_name, sizeof(task_pool_name), "task_pool_%d", rte_lcore_id());
|
snprintf(task_pool_name, sizeof(task_pool_name), "task_pool_%d", rte_lcore_id());
|
||||||
t->data_pool = spdk_mempool_create(buf_pool_name, g_user_config.queue_depth, SRC_BUFFER_SIZE, -1,
|
t->data_pool = spdk_mempool_create(buf_pool_name, g_user_config.queue_depth, SRC_BUFFER_SIZE,
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
SPDK_ENV_SOCKET_ID_ANY);
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
t->task_pool = spdk_mempool_create(task_pool_name, g_user_config.queue_depth,
|
t->task_pool = spdk_mempool_create(task_pool_name, g_user_config.queue_depth,
|
||||||
sizeof(struct ioat_task), -1, SPDK_ENV_SOCKET_ID_ANY);
|
sizeof(struct ioat_task),
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
if (!t->data_pool || !t->task_pool) {
|
if (!t->data_pool || !t->task_pool) {
|
||||||
fprintf(stderr, "Could not allocate buffer pool.\n");
|
fprintf(stderr, "Could not allocate buffer pool.\n");
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -137,11 +137,14 @@ void spdk_memzone_dump(FILE *f);
|
|||||||
|
|
||||||
struct spdk_mempool;
|
struct spdk_mempool;
|
||||||
|
|
||||||
|
#define SPDK_MEMPOOL_DEFAULT_CACHE_SIZE SIZE_MAX
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a thread-safe memory pool. Cache size is the number of
|
* Create a thread-safe memory pool.
|
||||||
* elements in a thread-local cache. Can be 0 for no caching, or -1
|
|
||||||
* for unspecified.
|
|
||||||
*
|
*
|
||||||
|
* \param cache_size How many elements may be cached in per-core caches. Use
|
||||||
|
* SPDK_MEMPOOL_DEFAULT_CACHE_SIZE for a reasonable default, or 0 for no
|
||||||
|
* per-core cache.
|
||||||
* \param socket_id Socket ID to allocate memory on, or SPDK_ENV_SOCKET_ID_ANY for any socket.
|
* \param socket_id Socket ID to allocate memory on, or SPDK_ENV_SOCKET_ID_ANY for any socket.
|
||||||
*/
|
*/
|
||||||
struct spdk_mempool *spdk_mempool_create(const char *name, size_t count,
|
struct spdk_mempool *spdk_mempool_create(const char *name, size_t count,
|
||||||
|
@ -197,7 +197,9 @@ __initialize_cache(void)
|
|||||||
|
|
||||||
g_cache_pool = spdk_mempool_create("spdk_fs_cache",
|
g_cache_pool = spdk_mempool_create("spdk_fs_cache",
|
||||||
g_fs_cache_size / CACHE_BUFFER_SIZE,
|
g_fs_cache_size / CACHE_BUFFER_SIZE,
|
||||||
CACHE_BUFFER_SIZE, -1, SPDK_ENV_SOCKET_ID_ANY);
|
CACHE_BUFFER_SIZE,
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
TAILQ_INIT(&g_caches);
|
TAILQ_INIT(&g_caches);
|
||||||
pthread_spin_init(&g_caches_lock, 0);
|
pthread_spin_init(&g_caches_lock, 0);
|
||||||
}
|
}
|
||||||
|
@ -559,7 +559,8 @@ spdk_reactors_init(unsigned int max_delay_us)
|
|||||||
snprintf(mempool_name, sizeof(mempool_name), "evtpool%d_%d", i, getpid());
|
snprintf(mempool_name, sizeof(mempool_name), "evtpool%d_%d", i, getpid());
|
||||||
g_spdk_event_mempool[i] = spdk_mempool_create(mempool_name,
|
g_spdk_event_mempool[i] = spdk_mempool_create(mempool_name,
|
||||||
(262144 / socket_count),
|
(262144 / socket_count),
|
||||||
sizeof(struct spdk_event), -1, i);
|
sizeof(struct spdk_event),
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE, i);
|
||||||
|
|
||||||
if (g_spdk_event_mempool[i] == NULL) {
|
if (g_spdk_event_mempool[i] == NULL) {
|
||||||
SPDK_ERRLOG("spdk_event_mempool creation failed on socket %d\n", i);
|
SPDK_ERRLOG("spdk_event_mempool creation failed on socket %d\n", i);
|
||||||
@ -573,7 +574,8 @@ spdk_reactors_init(unsigned int max_delay_us)
|
|||||||
g_spdk_event_mempool[i] = spdk_mempool_create(
|
g_spdk_event_mempool[i] = spdk_mempool_create(
|
||||||
mempool_name,
|
mempool_name,
|
||||||
(262144 / socket_count),
|
(262144 / socket_count),
|
||||||
sizeof(struct spdk_event), -1,
|
sizeof(struct spdk_event),
|
||||||
|
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||||
SPDK_ENV_SOCKET_ID_ANY);
|
SPDK_ENV_SOCKET_ID_ANY);
|
||||||
|
|
||||||
if (g_spdk_event_mempool[i] == NULL) {
|
if (g_spdk_event_mempool[i] == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user