Skip to contentSkip to conversation

save and restore cpus_allowed in cpu_idle_wait

PATCH New Siddha, Suresh B 1 participant 1 message May 8, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 save and restore cpus_allowed in cpu_idle_wait

Save and Restore the task's cpus_allowed mask, across the set_cpus_allowed() in cpu_idle_wait(). Without this, we will endup corrupting task's cpu affinity.

---

arch/ia64/kernel/process.c +2 -0
index ae96d41..cba6ac3 100644
@@ -237,6 +237,7 @@ void cpu_idle_wait(void)
 {
 	unsigned int cpu, this_cpu = get_cpu();
 	cpumask_t map;
+	cpumask_t tmp = current->cpus_allowed;
 
 	set_cpus_allowed(current, cpumask_of_cpu(this_cpu));
 	put_cpu();
@@ -258,6 +259,7 @@ void cpu_idle_wait(void)
 		}
 		cpus_and(map, map, cpu_online_map);
 	} while (!cpus_empty(map));
+	set_cpus_allowed(current, tmp);
 }
 EXPORT_SYMBOL_GPL(cpu_idle_wait);