From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org
Cc: "Paul E. McKenney" <paulmck@kernel.org>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Davidlohr Bueso <dave@stgolabs.net>,
Frederic Weisbecker <frederic@kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: PATCH v3 0/3] softirq: Use a dedicated thread for timer wakeups with forced-threading.
Date: Wed, 6 Nov 2024 15:51:36 +0100 [thread overview]
Message-ID: <20241106150419.2593080-1-bigeasy@linutronix.de> (raw)
Hi,
the following was in the PREEMPT_RT queue since last softirq rework. The
result is that timer wake ups (hrtimer, timer_list) happens in hardirq
processing them requires to wake ksoftirqd. ksoftirqd runs at SCHED_OTHER so it
will compete for resources with all other tasks in the system, potentially
delayed the processing further.
The idea was to let the timers be processed by a dedicated thread
running at low SCHED_FIFO priority.
While looking at it again, it might make sense to have the
pending_softirq flag per-thread to avoid threads with higher priority
picking up softirqs from low-priority threads. This isn't yet a problem
because adding softirqs for processing happens only from threaded
interrupts. So the low-priority thread will wait until the high-priority
thread is done. And the high-priority thread will PI-boost the
low-priority thread until it is done. It would only make sense to make
the flags per-thread once the BH lock is gone.
The patch is limited to the forced threaded case.
v2…v3 https://lore.kernel.org/all/20241024150413.518862-1-bigeasy@linutronix.de/
- Redo the comment in interrupt.h. Make it more verbose and add more
details. Frederick asked for it.
- After updating the comment I convinced myself that it also makes
sense to use this in the forced threaded case.
- Merged raise_hrtimer_softirq() and raise_timer_softirq() into a
single function since both use __raise_softirq_irqoff() in the
alternative case.
v1…v2 https://lore.kernel.org/all/20241004103842.131014-1-bigeasy@linutronix.de/
Frederick's comments:
- Use __raise_softirq_irqoff() to raise the softirq for !PREEMPT_RT. Also a
lockdep test to ensure that this is always invoked from an IRQ.
- Make raise_ktimers_thread() only OR the flag and nothing else to
align with __raise_softirq_irqoff(). The wake happens on return from
interrupt anyway.
- A comment in timersd_setup() and interrupt.h
- local_pending_timers() => local_timers_pending().
Sebastian
next reply other threads:[~2024-11-06 15:04 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-06 14:51 Sebastian Andrzej Siewior [this message]
2024-11-06 14:51 ` [PATCH v3 1/3] hrtimer: Use __raise_softirq_irqoff() to raise the softirq Sebastian Andrzej Siewior
2024-11-06 14:51 ` [PATCH v3 2/3] timers: " Sebastian Andrzej Siewior
2024-11-06 14:51 ` [PATCH v3 3/3] softirq: Use a dedicated thread for timer wakeups on PREEMPT_RT Sebastian Andrzej Siewior
2025-12-01 21:51 ` Jan Kiszka
2025-12-01 23:49 ` Luis Claudio R. Goncalves
2025-12-02 6:57 ` Jan Kiszka
2025-12-02 8:22 ` Sebastian Andrzej Siewior
2025-12-02 8:24 ` Sebastian Andrzej Siewior
2025-12-02 12:39 ` Jan Kiszka
2025-12-02 13:22 ` Sebastian Andrzej Siewior
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=20241106150419.2593080-1-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=anna-maria@linutronix.de \
--cc=dave@stgolabs.net \
--cc=frederic@kernel.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=tglx@linutronix.de \
/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