aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-04-04 21:11:06 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:44:58 -0400
commitf70316dace2bb99730800d47044acb818c6735f6 (patch)
tree03c0178c8d6c0213a82b800f4a3e00c2da9a4d5c
parentfc0e474840d1fd96f28fbd76d4f36b80e7ad1cc3 (diff)
generic: use new set_cpus_allowed_ptr function
* Use new set_cpus_allowed_ptr() function added by previous patch, which instead of passing the "newly allowed cpus" cpumask_t arg by value, pass it by pointer: -int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) +int set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t *new_mask) * Modify CPU_MASK_ALL Depends on: [sched-devel]: sched: add new set_cpus_allowed_ptr function Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--drivers/acpi/processor_throttling.c10
-rw-r--r--drivers/firmware/dcdbas.c4
-rw-r--r--drivers/pci/pci-driver.c9
-rw-r--r--kernel/cpu.c6
-rw-r--r--kernel/kmod.c2
-rw-r--r--kernel/rcutorture.c15
-rw-r--r--kernel/stop_machine.c2
7 files changed, 27 insertions, 21 deletions
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c
index 1b8e592a8241..0bba3a914e86 100644
--- a/drivers/acpi/processor_throttling.c
+++ b/drivers/acpi/processor_throttling.c
@@ -838,10 +838,10 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
838 * Migrate task to the cpu pointed by pr. 838 * Migrate task to the cpu pointed by pr.
839 */ 839 */
840 saved_mask = current->cpus_allowed; 840 saved_mask = current->cpus_allowed;
841 set_cpus_allowed(current, cpumask_of_cpu(pr->id)); 841 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id));
842 ret = pr->throttling.acpi_processor_get_throttling(pr); 842 ret = pr->throttling.acpi_processor_get_throttling(pr);
843 /* restore the previous state */ 843 /* restore the previous state */
844 set_cpus_allowed(current, saved_mask); 844 set_cpus_allowed_ptr(current, &saved_mask);
845 845
846 return ret; 846 return ret;
847} 847}
@@ -1025,7 +1025,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
1025 * it can be called only for the cpu pointed by pr. 1025 * it can be called only for the cpu pointed by pr.
1026 */ 1026 */
1027 if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) { 1027 if (p_throttling->shared_type == DOMAIN_COORD_TYPE_SW_ANY) {
1028 set_cpus_allowed(current, cpumask_of_cpu(pr->id)); 1028 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pr->id));
1029 ret = p_throttling->acpi_processor_set_throttling(pr, 1029 ret = p_throttling->acpi_processor_set_throttling(pr,
1030 t_state.target_state); 1030 t_state.target_state);
1031 } else { 1031 } else {
@@ -1056,7 +1056,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
1056 continue; 1056 continue;
1057 } 1057 }
1058 t_state.cpu = i; 1058 t_state.cpu = i;
1059 set_cpus_allowed(current, cpumask_of_cpu(i)); 1059 set_cpus_allowed_ptr(current, &cpumask_of_cpu(i));
1060 ret = match_pr->throttling. 1060 ret = match_pr->throttling.
1061 acpi_processor_set_throttling( 1061 acpi_processor_set_throttling(
1062 match_pr, t_state.target_state); 1062 match_pr, t_state.target_state);
@@ -1074,7 +1074,7 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
1074 &t_state); 1074 &t_state);
1075 } 1075 }
1076 /* restore the previous state */ 1076 /* restore the previous state */
1077 set_cpus_allowed(current, saved_mask); 1077 set_cpus_allowed_ptr(current, &saved_mask);
1078 return ret; 1078 return ret;
1079} 1079}
1080 1080
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 1636806ec55e..0ffef3b7c6ca 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -265,7 +265,7 @@ static int smi_request(struct smi_cmd *smi_cmd)
265 265
266 /* SMI requires CPU 0 */ 266 /* SMI requires CPU 0 */
267 old_mask = current->cpus_allowed; 267 old_mask = current->cpus_allowed;
268 set_cpus_allowed(current, cpumask_of_cpu(0)); 268 set_cpus_allowed_ptr(current, &cpumask_of_cpu(0));
269 if (smp_processor_id() != 0) { 269 if (smp_processor_id() != 0) {
270 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", 270 dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n",
271 __FUNCTION__); 271 __FUNCTION__);
@@ -285,7 +285,7 @@ static int smi_request(struct smi_cmd *smi_cmd)
285 ); 285 );
286 286
287out: 287out:
288 set_cpus_allowed(current, old_mask); 288 set_cpus_allowed_ptr(current, &old_mask);
289 return ret; 289 return ret;
290} 290}
291 291
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index e571c72e6753..e8d94fafc280 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -182,15 +182,18 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
182 struct mempolicy *oldpol; 182 struct mempolicy *oldpol;
183 cpumask_t oldmask = current->cpus_allowed; 183 cpumask_t oldmask = current->cpus_allowed;
184 int node = pcibus_to_node(dev->bus); 184 int node = pcibus_to_node(dev->bus);
185 if (node >= 0 && node_online(node)) 185
186 set_cpus_allowed(current, node_to_cpumask(node)); 186 if (node >= 0) {
187 node_to_cpumask_ptr(nodecpumask, node);
188 set_cpus_allowed_ptr(current, nodecpumask);
189 }
187 /* And set default memory allocation policy */ 190 /* And set default memory allocation policy */
188 oldpol = current->mempolicy; 191 oldpol = current->mempolicy;
189 current->mempolicy = NULL; /* fall back to system default policy */ 192 current->mempolicy = NULL; /* fall back to system default policy */
190#endif 193#endif
191 error = drv->probe(dev, id); 194 error = drv->probe(dev, id);
192#ifdef CONFIG_NUMA 195#ifdef CONFIG_NUMA
193 set_cpus_allowed(current, oldmask); 196 set_cpus_allowed_ptr(current, &oldmask);
194 current->mempolicy = oldpol; 197 current->mempolicy = oldpol;
195#endif 198#endif
196 return error; 199 return error;
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 2eff3f63abed..2011ad8d2697 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -232,9 +232,9 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen)
232 232
233 /* Ensure that we are not runnable on dying cpu */ 233 /* Ensure that we are not runnable on dying cpu */
234 old_allowed = current->cpus_allowed; 234 old_allowed = current->cpus_allowed;
235 tmp = CPU_MASK_ALL; 235 cpus_setall(tmp);
236 cpu_clear(cpu, tmp); 236 cpu_clear(cpu, tmp);
237 set_cpus_allowed(current, tmp); 237 set_cpus_allowed_ptr(current, &tmp);
238 238
239 p = __stop_machine_run(take_cpu_down, &tcd_param, cpu); 239 p = __stop_machine_run(take_cpu_down, &tcd_param, cpu);
240 240
@@ -268,7 +268,7 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen)
268out_thread: 268out_thread:
269 err = kthread_stop(p); 269 err = kthread_stop(p);
270out_allowed: 270out_allowed:
271 set_cpus_allowed(current, old_allowed); 271 set_cpus_allowed_ptr(current, &old_allowed);
272out_release: 272out_release:
273 cpu_hotplug_done(); 273 cpu_hotplug_done();
274 return err; 274 return err;
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 22be3ff3f363..e2764047ec03 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -165,7 +165,7 @@ static int ____call_usermodehelper(void *data)
165 } 165 }
166 166
167 /* We can run anywhere, unlike our parent keventd(). */ 167 /* We can run anywhere, unlike our parent keventd(). */
168 set_cpus_allowed(current, CPU_MASK_ALL); 168 set_cpus_allowed_ptr(current, CPU_MASK_ALL_PTR);
169 169
170 /* 170 /*
171 * Our parent is keventd, which runs with elevated scheduling priority. 171 * Our parent is keventd, which runs with elevated scheduling priority.
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c
index fd599829e72a..47894f919d4e 100644
--- a/kernel/rcutorture.c
+++ b/kernel/rcutorture.c
@@ -723,9 +723,10 @@ static int rcu_idle_cpu; /* Force all torture tasks off this CPU */
723 */ 723 */
724static void rcu_torture_shuffle_tasks(void) 724static void rcu_torture_shuffle_tasks(void)
725{ 725{
726 cpumask_t tmp_mask = CPU_MASK_ALL; 726 cpumask_t tmp_mask;
727 int i; 727 int i;
728 728
729 cpus_setall(tmp_mask);
729 get_online_cpus(); 730 get_online_cpus();
730 731
731 /* No point in shuffling if there is only one online CPU (ex: UP) */ 732 /* No point in shuffling if there is only one online CPU (ex: UP) */
@@ -737,25 +738,27 @@ static void rcu_torture_shuffle_tasks(void)
737 if (rcu_idle_cpu != -1) 738 if (rcu_idle_cpu != -1)
738 cpu_clear(rcu_idle_cpu, tmp_mask); 739 cpu_clear(rcu_idle_cpu, tmp_mask);
739 740
740 set_cpus_allowed(current, tmp_mask); 741 set_cpus_allowed_ptr(current, &tmp_mask);
741 742
742 if (reader_tasks) { 743 if (reader_tasks) {
743 for (i = 0; i < nrealreaders; i++) 744 for (i = 0; i < nrealreaders; i++)
744 if (reader_tasks[i]) 745 if (reader_tasks[i])
745 set_cpus_allowed(reader_tasks[i], tmp_mask); 746 set_cpus_allowed_ptr(reader_tasks[i],
747 &tmp_mask);
746 } 748 }
747 749
748 if (fakewriter_tasks) { 750 if (fakewriter_tasks) {
749 for (i = 0; i < nfakewriters; i++) 751 for (i = 0; i < nfakewriters; i++)
750 if (fakewriter_tasks[i]) 752 if (fakewriter_tasks[i])
751 set_cpus_allowed(fakewriter_tasks[i], tmp_mask); 753 set_cpus_allowed_ptr(fakewriter_tasks[i],
754 &tmp_mask);
752 } 755 }
753 756
754 if (writer_task) 757 if (writer_task)
755 set_cpus_allowed(writer_task, tmp_mask); 758 set_cpus_allowed_ptr(writer_task, &tmp_mask);
756 759
757 if (stats_task) 760 if (stats_task)
758 set_cpus_allowed(stats_task, tmp_mask); 761 set_cpus_allowed_ptr(stats_task, &tmp_mask);
759 762
760 if (rcu_idle_cpu == -1) 763 if (rcu_idle_cpu == -1)
761 rcu_idle_cpu = num_online_cpus() - 1; 764 rcu_idle_cpu = num_online_cpus() - 1;
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 6f4e0e13f70c..e1b2a5b1b105 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -35,7 +35,7 @@ static int stopmachine(void *cpu)
35 int irqs_disabled = 0; 35 int irqs_disabled = 0;
36 int prepared = 0; 36 int prepared = 0;
37 37
38 set_cpus_allowed(current, cpumask_of_cpu((int)(long)cpu)); 38 set_cpus_allowed_ptr(current, &cpumask_of_cpu((int)(long)cpu));
39 39
40 /* Ack: we are alive */ 40 /* Ack: we are alive */
41 smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */ 41 smp_mb(); /* Theoretically the ack = 0 might not be on this CPU yet. */