On Wed, 17 Jun 2009, Thomas Gleixner wrote:
The irq/softirq threads call sys_sched_setscheduler() already to change their priorities. The right way to do this is to have an interface set_irq_thread_prio(irq, prio)
I just wrote such a function, and it appears to work. I couldn't get it to work with sys_sched_setscheduler(), since this returned -EFAULT, indicating that it didn't like the provenance of the sched_param argument. I thus instead used the non-syscall variant, sched_setscheduler(), protecting the target task structure from deletion by bracketing the code with calls to read_lock(&tasklist_lock), and read_unlock(&tasklist_lock). Hopefully that is the right lock to take. The implemenation, which I added to kernel/irq/manage.c, is as follows: #ifdef CONFIG_PREEMPT_HARDIRQS int set_irq_thread_prio(unsigned int irq, int prio) { struct irq_desc *desc = irq_to_desc(irq); struct sched_param param = { 0, }; int status; param.sched_priority = prio; if(desc) { read_lock(&tasklist_lock); if(desc->thread) status = sched_setscheduler(desc->thread, SCHED_FIFO, ¶m); else status = -ENODEV; read_unlock(&tasklist_lock); } else { status = -ENODEV; } return status; } EXPORT_SYMBOL(set_irq_thread_prio); #endif I also put the corresponding function prototype in include/linux/irq.h. I called this from my device-driver, and ran my test program with it a few times, and it worked fine. Should I submit this as a patch as-is, or is there anything problematic that I should fix first? Thanks, Martin -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html