DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>
Subject: Re: Thread priority for background tasks
Date: Wed, 30 Apr 2025 12:45:26 -0700	[thread overview]
Message-ID: <20250430124526.6184f79f@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FC19@smartserver.smartshare.dk>

On Wed, 30 Apr 2025 20:40:52 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:

> There are only two thread priorities in the enum rte_thread_priority: Normal and Real-time Critical.
> 
> I would like to poll ethdev counters, collect garbage and perform other jitter non-sensitive tasks in a control thread with lower priority than my ordinary control threads, so it will be preempted by any work ready for my ordinary control threads.
> 
> Which DPDK API am I supposed to use to assign this below-normal priority to my "background" control thread?
> 
> Or: Aren't we missing a priority like Linux' SCHED_BATCH?
> 
> 
> Med venlig hilsen / Kind regards,
> -Morten Brørup
> 

Short answer: if your application is running on Linux, only ever use Normal.
DPDK applications usually never sleep and this will starve the OS and cause instability.

Long answer:
Realtime critical was added for Windows, which needs it and doesn't do the
same real RT behavior. Might work on FreeBSD, not sure how the scheduler works.

On Linux, it is possible to use but only if the application is not a 100% polling.
(i.e a real time application not a polling application).
It needs to regularly sleep to allow non-RT kernel threads to run, otherwise things
like disk writes that are pending on that CPU may not happen, leading to filesystem
corruption. Or hangs.

Bottom line:
Real time critical means this needs to run for a short time now (i.e safety switch).
RT does not mean this is more important overall, or needs to run faster.

      reply	other threads:[~2025-04-30 19:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-30 18:40 Morten Brørup
2025-04-30 19:45 ` Stephen Hemminger [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=20250430124526.6184f79f@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.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).