env: add spdk_mempool_create() socket_id parameter
Change-Id: I8ab0bb2c6e1fdf1681fbd049a096c1768e54dc27 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
4c55092882
commit
b809cdd3ab
@ -492,8 +492,10 @@ associate_workers_with_chan(void)
|
||||
t->ioat_chan_id = 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);
|
||||
t->data_pool = spdk_mempool_create(buf_pool_name, 512, g_user_config.xfer_size_bytes, -1);
|
||||
t->task_pool = spdk_mempool_create(task_pool_name, 512, sizeof(struct ioat_task), -1);
|
||||
t->data_pool = spdk_mempool_create(buf_pool_name, 512, g_user_config.xfer_size_bytes, -1,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
t->task_pool = spdk_mempool_create(task_pool_name, 512, sizeof(struct ioat_task), -1,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (!t->data_pool || !t->task_pool) {
|
||||
fprintf(stderr, "Could not allocate buffer pool.\n");
|
||||
spdk_mempool_free(t->data_pool);
|
||||
|
@ -335,9 +335,10 @@ work_fn(void *arg)
|
||||
|
||||
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());
|
||||
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, -1,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
t->task_pool = spdk_mempool_create(task_pool_name, g_user_config.queue_depth,
|
||||
sizeof(struct ioat_task), -1);
|
||||
sizeof(struct ioat_task), -1, SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (!t->data_pool || !t->task_pool) {
|
||||
fprintf(stderr, "Could not allocate buffer pool.\n");
|
||||
return 1;
|
||||
|
@ -107,9 +107,11 @@ struct spdk_mempool;
|
||||
* Create a thread-safe memory pool. Cache size is the number of
|
||||
* elements in a thread-local cache. Can be 0 for no caching, or -1
|
||||
* for unspecified.
|
||||
*
|
||||
* \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,
|
||||
size_t ele_size, size_t cache_size);
|
||||
size_t ele_size, size_t cache_size, int socket_id);
|
||||
|
||||
/**
|
||||
* Free a memory pool.
|
||||
|
@ -130,11 +130,15 @@ spdk_memzone_dump(FILE *f)
|
||||
|
||||
struct spdk_mempool *
|
||||
spdk_mempool_create(const char *name, size_t count,
|
||||
size_t ele_size, size_t cache_size)
|
||||
size_t ele_size, size_t cache_size, int socket_id)
|
||||
{
|
||||
struct rte_mempool *mp;
|
||||
size_t tmp;
|
||||
|
||||
if (socket_id == SPDK_ENV_SOCKET_ID_ANY) {
|
||||
socket_id = SOCKET_ID_ANY;
|
||||
}
|
||||
|
||||
/* No more than half of all elements can be in cache */
|
||||
tmp = (count / 2) / rte_lcore_count();
|
||||
if (cache_size > tmp) {
|
||||
@ -147,7 +151,7 @@ spdk_mempool_create(const char *name, size_t count,
|
||||
|
||||
mp = rte_mempool_create(name, count, ele_size, cache_size,
|
||||
0, NULL, NULL, NULL, NULL,
|
||||
SOCKET_ID_ANY, 0);
|
||||
socket_id, 0);
|
||||
|
||||
return (struct spdk_mempool *)mp;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ spdk_reactors_init(const char *mask, unsigned int max_delay_us)
|
||||
snprintf(mempool_name, sizeof(mempool_name), "spdk_event_mempool_%d", i);
|
||||
g_spdk_event_mempool[i] = spdk_mempool_create(mempool_name,
|
||||
(262144 / socket_count),
|
||||
sizeof(struct spdk_event), -1);
|
||||
sizeof(struct spdk_event), -1, i);
|
||||
|
||||
if (g_spdk_event_mempool[i] == NULL) {
|
||||
SPDK_ERRLOG("spdk_event_mempool creation failed on socket %d\n", i);
|
||||
@ -627,7 +627,8 @@ spdk_reactors_init(const char *mask, unsigned int max_delay_us)
|
||||
g_spdk_event_mempool[i] = spdk_mempool_create(
|
||||
mempool_name,
|
||||
(262144 / socket_count),
|
||||
sizeof(struct spdk_event), -1);
|
||||
sizeof(struct spdk_event), -1,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
|
||||
/* TODO: in DPDK 16.04, free mempool API is avaialbe. */
|
||||
if (g_spdk_event_mempool[i] == NULL) {
|
||||
|
@ -281,7 +281,7 @@ nvme_driver_init(void)
|
||||
TAILQ_INIT(&g_spdk_nvme_driver->attached_ctrlrs);
|
||||
|
||||
g_spdk_nvme_driver->request_mempool = spdk_mempool_create("nvme_request", 8192,
|
||||
sizeof(struct nvme_request), 128);
|
||||
sizeof(struct nvme_request), 128, SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (g_spdk_nvme_driver->request_mempool == NULL) {
|
||||
SPDK_ERRLOG("unable to allocate pool of requests\n");
|
||||
|
||||
|
@ -98,7 +98,7 @@ spdk_memzone_free(const char *name)
|
||||
|
||||
struct spdk_mempool *
|
||||
spdk_mempool_create(const char *name, size_t count,
|
||||
size_t ele_size, size_t cache_size)
|
||||
size_t ele_size, size_t cache_size, int socket_id)
|
||||
{
|
||||
static int mp = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user