[PATCH] uio: eliminate extraneous irq thread under CONFIG_PREEMPT_RT
From: Mike Schanne
Date: Wed Aug 19 2026 - 11:08:09 EST
From 435db0a75de98d2021e02381a15a300137a544b3 Mon Sep 17 00:00:00 2001
From: Michael Schanne <mschanne@xxxxxxx>
Date: Wed, 5 Aug 2026 14:34:22 -0400
Subject: [PATCH] uio: eliminate extraneous irq thread under CONFIG_PREEMPT_RT
Commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6 ("uio: use threaded
interrupts") makes all uio interrupts threaded by default. However
under CONFIG_PREEMPT_RT, all interrupts are already threaded. This
results in 2 irq threads per uio instance, adding an unnecessary
extra context switch per interrupt.
Do not request a threaded interrupt for uio under CONFIG_PREEMPT_RT
Signed-off-by: Michael Schanne <mschanne@xxxxxxx>
---
drivers/uio/uio.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 004a549c6..4e28777ac 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -448,8 +448,12 @@ static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
irqreturn_t ret;
ret = idev->info->handler(irq, idev->info);
- if (ret == IRQ_HANDLED)
- ret = IRQ_WAKE_THREAD;
+ if (ret == IRQ_HANDLED) {
+ if (IS_ENABLED(CONFIG_PREEMPT_RT))
+ uio_event_notify(idev->info);
+ else
+ ret = IRQ_WAKE_THREAD;
+ }
return ret;
}
@@ -1038,8 +1042,13 @@ int __uio_register_device(struct module *owner,
* FDs at the time of unregister and therefore may not be
* freed until they are released.
*/
- ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
- info->irq_flags, info->name, idev);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
+ ret = request_irq(info->irq, uio_interrupt_handler,
+ info->irq_flags, info->name, idev);
+ } else {
+ ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
+ info->irq_flags, info->name, idev);
+ }
if (ret) {
info->uio_dev = NULL;
goto err_request_irq;
--
2.34.1
This email is non-binding, is subject to contract, and neither Kulicke and Soffa Industries, Inc. nor its subsidiaries (each and collectively “K&S”) shall have any obligation to you to consummate the transactions herein or to enter into any agreement, other than in accordance with the terms and conditions of a definitive agreement if and when negotiated, finalized and executed between the parties. This email and all its contents are protected by International and United States copyright laws. Any reproduction or use of all or any part of this email without the express written consent of K&S is prohibited.