* Is rte_mempool library is multi-thread safe ??? @ 2013-12-19 10:57 ankit kumar [not found] ` <CAG9qd2pi-Q7LawBymDSsAY3054FUqf7RK0L61oDrsKVY_Q4S0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: ankit kumar @ 2013-12-19 10:57 UTC (permalink / raw) To: dev Hi, I was testing rte_ring in DPDK as it provides multi-consumer & multi-produce queue(lock-free but not wait-free). It was working fine but i am not sure that memory allocation & deallocation in rte_mempool library, is multi-thread safe or not. Because its giving me error during allocation(from multi-thread) as "Allocation failed(returned pointer is NULL in allocation function rte_pktmbuf_alloc())" & during rte_pktmbuf_free() it generates segmentation fault and when i traced out, core file generated, it indicated that the problem is in rte_pktmbuf_free(). Any help !!! ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAG9qd2pi-Q7LawBymDSsAY3054FUqf7RK0L61oDrsKVY_Q4S0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Is rte_mempool library is multi-thread safe ??? [not found] ` <CAG9qd2pi-Q7LawBymDSsAY3054FUqf7RK0L61oDrsKVY_Q4S0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-12-19 17:04 ` Thomas Monjalon [not found] ` <201312191804.31322.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Thomas Monjalon @ 2013-12-19 17:04 UTC (permalink / raw) To: ankit kumar; +Cc: dev-VfR2kkLFssw Hello, 19/12/2013 11:57, ankit kumar : > It was working fine but i am not sure that memory allocation & > deallocation in rte_mempool library, is multi-thread safe or not. From http://dpdk.org/doc/api/rte__mempool_8h.html: "the mempool implementation is not preemptable" There is more explanations in this email: http://dpdk.org/ml/archives/dev/2013-August/000402.html -- Thomas ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <201312191804.31322.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>]
* Re: Is rte_mempool library is multi-thread safe ??? [not found] ` <201312191804.31322.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> @ 2013-12-19 21:30 ` Peter Chen [not found] ` <CAMGYKAfuRdhuydXixJ-ycTQcksRqSKOmFpz8fJGuNZEob04E6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Peter Chen @ 2013-12-19 21:30 UTC (permalink / raw) To: Thomas Monjalon; +Cc: dev-VfR2kkLFssw does that mean that on the same core, we can't do rte_eth_rx_burst in one thread (I assume this function allocates from mempool for storing mbufs everytime it receives a packet), while another thread calls rte_pktmbuf_alloc from the same mem_pool? On Thu, Dec 19, 2013 at 9:04 AM, Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>wrote: > Hello, > > 19/12/2013 11:57, ankit kumar : > > It was working fine but i am not sure that memory allocation & > > deallocation in rte_mempool library, is multi-thread safe or not. > > From http://dpdk.org/doc/api/rte__mempool_8h.html: > "the mempool implementation is not preemptable" > There is more explanations in this email: > http://dpdk.org/ml/archives/dev/2013-August/000402.html > > -- > Thomas > ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <CAMGYKAfuRdhuydXixJ-ycTQcksRqSKOmFpz8fJGuNZEob04E6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: Is rte_mempool library is multi-thread safe ??? [not found] ` <CAMGYKAfuRdhuydXixJ-ycTQcksRqSKOmFpz8fJGuNZEob04E6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-12-20 21:28 ` Olivier MATZ 0 siblings, 0 replies; 4+ messages in thread From: Olivier MATZ @ 2013-12-20 21:28 UTC (permalink / raw) To: Peter Chen; +Cc: dev-VfR2kkLFssw Hi Peter, On 12/19/2013 10:30 PM, Peter Chen wrote: > does that mean that on the same core, we can't do rte_eth_rx_burst in one > thread (I assume this function allocates from mempool for storing mbufs > everytime it receives a packet), while another thread calls > rte_pktmbuf_alloc from the same mem_pool? That's correct. In the rte_mempool code, there is a per-lcore cache: see the local_cache field of struct rte_mempool. If you are running several pthreads per lcore, they will share the same cache if they have the same lcore_id and the mempool is not designed for that. Therefore it can return wrong results. The cache can be disabled (at run-time or compile-time), but you will loose a lot of performance. Even if you solve the problem of the cache, as the mempool uses a ring internally, you would still experiment performance issues (see links from Thomas' previous email). By the way, why would you need to have several pthreads on one lcore? Regards, Olivier ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-12-20 21:28 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-12-19 10:57 Is rte_mempool library is multi-thread safe ??? ankit kumar [not found] ` <CAG9qd2pi-Q7LawBymDSsAY3054FUqf7RK0L61oDrsKVY_Q4S0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-12-19 17:04 ` Thomas Monjalon [not found] ` <201312191804.31322.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> 2013-12-19 21:30 ` Peter Chen [not found] ` <CAMGYKAfuRdhuydXixJ-ycTQcksRqSKOmFpz8fJGuNZEob04E6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-12-20 21:28 ` Olivier MATZ
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).