genirq: Delegate irq affinity setting to the irq thread

irq_set_thread_affinity() calls set_cpus_allowed_ptr() which might
sleep, but irq_set_thread_affinity() is called with desc->lock held
and can be called from hard interrupt context as well. The code has
another bug as it does not hold a ref on the task struct as required
by set_cpus_allowed_ptr().

Just set the IRQTF_AFFINITY bit in action->thread_flags. The next time
the thread runs it migrates itself. Solves all of the above problems
nicely.

Add kerneldoc to irq_set_thread_affinity() while at it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
This commit is contained in:
Thomas Gleixner
2009-07-21 11:09:39 +02:00
parent aea1f7964a
commit 591d2fb02e
4 changed files with 48 additions and 9 deletions

View File

@@ -42,8 +42,7 @@ static inline void unregister_handler_proc(unsigned int irq,
extern int irq_select_affinity_usr(unsigned int irq);
extern void
irq_set_thread_affinity(struct irq_desc *desc, const struct cpumask *cpumask);
extern void irq_set_thread_affinity(struct irq_desc *desc);
/*
* Debugging printout: