[prev in list] [next in list] [prev in thread] [next in thread]
List: dpdk-dev
Subject: [dpdk-dev] =?gbk?b?SXMgobFydGVfbWVtcG9vbF9tcF9wdXRfYnVsaygpobAg?=
From: olivier.matz () 6wind ! com (Olivier MATZ)
Date: 2013-08-13 11:47:32
Message-ID: 520A1CD4.3020601 () 6wind ! com
[Download RAW message or body]
Hi,
> My question is :rte_mempool_mp_put_bulk() and
> rte_mempool_sp_put_bulk() call the same function __mempool_put_bulk()
> with different "is_mp" value. If is_mp=1, that is ,multi-producer, the
> code will add these objects in cache while there is enough room, when
> two thread enqueue objects at the same time, isn't it unsafe?but the
> annotation show this function is "multi-producer safe".
This is not the only difference: rte_mempool_mp_put() will call
rte_ring_mp_enqueue() to add the objects from cache to the common
pool. This function uses a compare_and_set() to update the head/tail
indexes.
And rte_mempool_sp_put() uses rte_ring_mp_enqueue() which is simpler but
not thread safe.
> Another question: how many thread we can have on a core? just one?
Yes. Both mempool and ring are designed to run with one pthread per
lcore: mempool uses a per-lcore cache, and the ring_mp/mc functions
assume that a pthread is not interrupted by another pthread.
Regards,
Olivier
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic