[dpdk-dev] Thread preemption and rte_ring

Olivier MATZ olivier.matz at 6wind.com
Tue Nov 5 16:26:31 CET 2013


Hello Dmitry,

 > Documentation for rte_ring says: the ring implementation is not
 > preemptable. A lcore must not be interrupted by another task that uses
 > the same ring. What does it precisely mean? Must all the producers and
 > consumers be non-preemptive?

The "non-preemptive" constraint means:

- a pthread doing multi-producers enqueues on a given ring must not
   be preempted by another pthread doing a multi-producer enqueue on
   the same ring.
- a pthread doing multi-consumers dequeues on a given ring must not
   be preempted by another pthread doing a multi-consumer dequeue on
   the same ring.

Bypassing this constraints may cause the 2nd pthread to spin until the
1st one is scheduled again.
Moreover, if the 1st pthread is preempted by a context that has an
higher priority (for instance a kernel thread), it can even cause
a dead lock.

 > Can we relax that restriction somehow? Say,
 > can I have multiple non-preemptive writers running on dedicated cores
 > and a single reader running as a regular Linux thread?

Yes, this should work.

Regards,
Olivier



More information about the dev mailing list