Re: Setting the priority of an IRQ thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 16 Jun 2009, Martin Shepherd wrote:

> Suresh Kumar SHUKLA <suresh.shukla <at> st.com> writes:
> > 	// get IRQ descriptor from IRQ, it contains pid
> > 	desc = &irq_desc[IRQ_BASIC_TIMER_3_1];
> 
> That's a very useful clue. I was thinking that I would have to walk the process
> tree to find the thread by name. Following up on this clue, it appears as though
> in kernel 2.6.29.4 I should be able to use desc=irq_to_desc(irq) to look up the
> IRQ descriptor, then use pid=get_task_pid(desc->thread), to get the PID of the
> IRQ thread, then use sys_sched_setscheduler(pid,...) to change its priority.
> I'll try that out in the morning.
> 

FYI, i use following code to set the interrupt thread prio on first interrupt 
and it works so far:

atomic_t first_irq;

static irqreturn_t irq_handler (int irq, void *devp)
{
#ifdef CONFIG_PREEMPT_HARDIRQS
	if (atomic_cmpxchg (&first_irq, 1, 0))
	{
		struct sched_param param = { .sched_priority = 55 };

		/* raise thread prio on first interrupt */
		sched_setscheduler(current, SCHED_FIFO, &param);
	}
#endif

	/* handle interrupt */

	return IRQ_RETVAL(IRQ_HANDLED);
}

static int init_irqhandler (void)
{
	request_irq (...);
	atomic_set (&dev->first_irq, 1);

	...
}

Thomas
--
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

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux