DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz@6wind.com>
To: Dmitry Vyal <dmitryvyal@gmail.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] Thread preemption and rte_ring
Date: Tue, 05 Nov 2013 16:26:31 +0100	[thread overview]
Message-ID: <52790E27.4060103@6wind.com> (raw)
In-Reply-To: <5278CC7B.9040600@gmail.com>

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

      reply	other threads:[~2013-11-05 15:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 10:46 Dmitry Vyal
2013-11-05 15:26 ` Olivier MATZ [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52790E27.4060103@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=dmitryvyal@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).