On 12/16/16 11:06, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>>
>> @@ -172,6 +172,7 @@ static pool_t *reserve_pool(void)
>>  {
>>      int i;
>>      pool_t *pool;
>> +    char ring_name[ODP_POOL_NAME_LEN];
>>
>>      for (i = 0; i < ODP_CONFIG_POOLS; i++) {
>>              pool = pool_entry(i);
>> @@ -180,6 +181,17 @@ static pool_t *reserve_pool(void)
>>              if (pool->reserved == 0) {
>>                      pool->reserved = 1;
>>                      UNLOCK(&pool->lock);
>> +                    sprintf(ring_name, "_odp_pool_ring_%d", i);


shm reserve will create /tmp/odp-pid-_odp_pool_ring_%d

which looks like more odp works there. I think name pool_ring_%d is
better here.

Maxim.


>> +                    pool->ring_shm =
>> +                            odp_shm_reserve(ring_name,
>> +                                            sizeof(pool_ring_t),
>> +                                            ODP_CACHE_LINE_SIZE, 0);
>> +                    if (pool->ring_shm == ODP_SHM_INVALID) {
>> +                            ODP_ERR("Unable to alloc pool ring %d\n", i);
>> +                            pool->reserved = 0;
> 
> This must be modified inside the lock, otherwise there's a race condition if 
> a pool is reserved or not.
> 
> Also, I'd like to have performance impact of the extra indirection verified.
> 
> -Petri
> 

Reply via email to