reactor: add pid to names for rings and mempools

This is required for using the event framework
in multi-process mode since they must be unique
across the group of processes..

Currently the stub app calls into the env layer
directly, bypassing the event framework, so this
issue would only be seen with multiple secondary
processes using the app framework.  Some future
changes will change the stub app to use the event
framework which necessitates this change immediately.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I5e1acc95380a20a0204c327906c7ef83a82d7fac

Reviewed-on: https://review.gerrithub.io/366647
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2017-06-22 07:57:54 -07:00
parent e2a5855afd
commit c588baab29
2 changed files with 3 additions and 3 deletions

View File

@ -277,8 +277,8 @@ spdk_ring_create(enum spdk_ring_type type, size_t count, int socket_id)
return NULL;
}
snprintf(ring_name, sizeof(ring_name), "spdk_ring_%u",
__sync_fetch_and_add(&ring_num, 1));
snprintf(ring_name, sizeof(ring_name), "ring_%u_%d",
__sync_fetch_and_add(&ring_num, 1), getpid());
return (struct spdk_ring *)rte_ring_create(ring_name, count, socket_id, flags);
}

View File

@ -556,7 +556,7 @@ spdk_reactors_init(unsigned int max_delay_us)
for (i = 0; i < SPDK_MAX_SOCKET; i++) {
if ((1ULL << i) & socket_mask) {
snprintf(mempool_name, sizeof(mempool_name), "spdk_event_mempool_%d", i);
snprintf(mempool_name, sizeof(mempool_name), "evtpool%d_%d", i, getpid());
g_spdk_event_mempool[i] = spdk_mempool_create(mempool_name,
(262144 / socket_count),
sizeof(struct spdk_event), -1, i);