lkml.org 
[lkml]   [2011]   [Jul]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[RFC PATCH] MIPS/octeon: select online CPU for irq
From
The tiny probability of dead loop is removed if all bound CPUs of given irq go
offline, and selected CPU is always checked to be online.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---
arch/mips/cavium-octeon/octeon-irq.c | 32 +++++++++++---------------------
1 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-irq.c
b/arch/mips/cavium-octeon/octeon-irq.c
index ffd4ae6..7b678e3 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -198,28 +198,18 @@ static void __init octeon_irq_init_core(void)

static int next_cpu_for_irq(struct irq_data *data)
{
-
#ifdef CONFIG_SMP
- int cpu;
- int weight = cpumask_weight(data->affinity);
-
- if (weight > 1) {
- cpu = smp_processor_id();
- for (;;) {
- cpu = cpumask_next(cpu, data->affinity);
- if (cpu >= nr_cpu_ids) {
- cpu = -1;
- continue;
- } else if (cpumask_test_cpu(cpu, cpu_online_mask)) {
- break;
- }
- }
- } else if (weight == 1) {
- cpu = cpumask_first(data->affinity);
- } else {
- cpu = smp_processor_id();
- }
- return cpu;
+ int cpu = smp_processor_id();
+
+ cpu = cpumask_next_and(cpu, data->affinity, cpu_online_mask);
+ if (cpu < nr_cpu_ids)
+ return cpu;
+
+ cpu = cpumask_first_and(data->affinity, cpu_online_mask);
+ if (cpu < nr_cpu_ids)
+ return cpu;
+
+ return smp_processor_id();
#else
return smp_processor_id();
#endif

\
 
 \ /
  Last update: 2011-07-31 05:17    [W:0.043 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site