linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <sebastian.siewior@linutronix.de>
To: Joachim Achtzehnter <joachima@netacquire.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: Undesirable priority inversion for real-time threads that use timerfd
Date: Thu, 8 Sep 2016 12:24:08 +0200	[thread overview]
Message-ID: <20160908102408.n4cc2e6vjslyprgm@linutronix.de> (raw)
In-Reply-To: <e1363850-537a-f6d1-52c7-3e7398374b49@netacquire.com>

On 2016-09-02 17:25:55 [-0700], Joachim Achtzehnter wrote:
> The only downside of this fix is that all timeouts used by low-priority
> threads, presumably even non-real-time threads, will briefly preempt our
> high-priority threads, although hopefully not for long, hence there may be
> some impact on throughput.

_all_ timers which are not marked as irq_safe are deferred here to the
timersoftirq. This is because they take (possible long standing)
sleeping locks.

> A possibly more optimal approach would be to have a separate ktimersoftd
> thread for every priority at which threads wait for timer notifications. We
you don't know this in advance. You are in hardirq context and a hrtimer
expires. You invoke the timerfd callback, need to take a sleeping lock
to figure out who is waiting on this. *That* is the point you learn
about the waiter.

> could potentially build such a facility in user code, as long as there is
> some timer available that is not dependent on ktimersoftd. What about Posix
> timers? Would they have the same issue? Anything else we should be looking
> at?

posix timers have the same issue. Basically all timers which are not
marked as irq_safe are completed in ktimersoftd. If you look at
clock_nanosleep() you will see that it is marked as irqsafe and the wake
up happens in hardirq.

Btw: the situation got better once we got ktimersoftd. Before that it
was a little worse.

> Thanks,
> 
> Joachim

Sebastian

      reply	other threads:[~2016-09-08 10:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-03  0:25 Undesirable priority inversion for real-time threads that use timerfd Joachim Achtzehnter
2016-09-08 10:24 ` Sebastian Andrzej Siewior [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=20160908102408.n4cc2e6vjslyprgm@linutronix.de \
    --to=sebastian.siewior@linutronix.de \
    --cc=joachima@netacquire.com \
    --cc=linux-rt-users@vger.kernel.org \
    /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).