x86: use performance variant for_each_cpu_mask_nr
Mike Travis [Mon, 12 May 2008 19:21:13 +0000 (21:21 +0200)]
Change references from for_each_cpu_mask to for_each_cpu_mask_nr
where appropriate

Reviewed-by: Paul Jackson <pj@sgi.com>
Reviewed-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

commit 2d474871e2fb092eb46a0930aba5442e10eb96cc
Author: Mike Travis <travis@sgi.com>
Date:   Mon May 12 21:21:13 2008 +0200

arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/mcheck/mce_amd_64.c
arch/x86/kernel/io_apic_64.c
arch/x86/kernel/smpboot.c
arch/x86/xen/smp.c
include/asm-x86/ipi.h

index b0c8208..dd097b8 100644 (file)
@@ -202,7 +202,7 @@ static void drv_write(struct drv_cmd *cmd)
        cpumask_t saved_mask = current->cpus_allowed;
        unsigned int i;
 
-       for_each_cpu_mask(i, cmd->mask) {
+       for_each_cpu_mask_nr(i, cmd->mask) {
                set_cpus_allowed_ptr(current, &cpumask_of_cpu(i));
                do_drv_write(cmd);
        }
@@ -451,7 +451,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
 
        freqs.old = perf->states[perf->state].core_frequency * 1000;
        freqs.new = data->freq_table[next_state].frequency;
-       for_each_cpu_mask(i, cmd.mask) {
+       for_each_cpu_mask_nr(i, cmd.mask) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -466,7 +466,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
                }
        }
 
-       for_each_cpu_mask(i, cmd.mask) {
+       for_each_cpu_mask_nr(i, cmd.mask) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
index 199e4e0..f1685fb 100644 (file)
@@ -122,7 +122,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
                return 0;
 
        /* notifiers */
-       for_each_cpu_mask(i, policy->cpus) {
+       for_each_cpu_mask_nr(i, policy->cpus) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -130,11 +130,11 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
        /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
         * Developer's Manual, Volume 3
         */
-       for_each_cpu_mask(i, policy->cpus)
+       for_each_cpu_mask_nr(i, policy->cpus)
                cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
 
        /* notifiers */
-       for_each_cpu_mask(i, policy->cpus) {
+       for_each_cpu_mask_nr(i, policy->cpus) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
index 46d4034..06d6eea 100644 (file)
@@ -966,7 +966,7 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
        freqs.old = find_khz_freq_from_fid(data->currfid);
        freqs.new = find_khz_freq_from_fid(fid);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -974,7 +974,7 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, unsigned i
        res = transition_fid_vid(data, fid, vid);
        freqs.new = find_khz_freq_from_fid(data->currfid);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
@@ -997,7 +997,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
        freqs.old = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
        freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -1005,7 +1005,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data, unsigned i
        res = transition_pstate(data, pstate);
        freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);
 
-       for_each_cpu_mask(i, *(data->available_cores)) {
+       for_each_cpu_mask_nr(i, *(data->available_cores)) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
index 908dd34..8b0dd6f 100644 (file)
@@ -476,7 +476,7 @@ static int centrino_target (struct cpufreq_policy *policy,
        saved_mask = current->cpus_allowed;
        first_cpu = 1;
        cpus_clear(covered_cpus);
-       for_each_cpu_mask(j, online_policy_cpus) {
+       for_each_cpu_mask_nr(j, online_policy_cpus) {
                /*
                 * Support for SMP systems.
                 * Make sure we are running on CPU that wants to change freq
@@ -517,7 +517,7 @@ static int centrino_target (struct cpufreq_policy *policy,
                        dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
                                target_freq, freqs.old, freqs.new, msr);
 
-                       for_each_cpu_mask(k, online_policy_cpus) {
+                       for_each_cpu_mask_nr(k, online_policy_cpus) {
                                freqs.cpu = k;
                                cpufreq_notify_transition(&freqs,
                                        CPUFREQ_PRECHANGE);
@@ -540,7 +540,7 @@ static int centrino_target (struct cpufreq_policy *policy,
                preempt_enable();
        }
 
-       for_each_cpu_mask(k, online_policy_cpus) {
+       for_each_cpu_mask_nr(k, online_policy_cpus) {
                freqs.cpu = k;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
@@ -554,7 +554,7 @@ static int centrino_target (struct cpufreq_policy *policy,
                 */
 
                if (!cpus_empty(covered_cpus)) {
-                       for_each_cpu_mask(j, covered_cpus) {
+                       for_each_cpu_mask_nr(j, covered_cpus) {
                                set_cpus_allowed_ptr(current,
                                                     &cpumask_of_cpu(j));
                                wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
@@ -564,7 +564,7 @@ static int centrino_target (struct cpufreq_policy *policy,
                tmp = freqs.new;
                freqs.new = freqs.old;
                freqs.old = tmp;
-               for_each_cpu_mask(j, online_policy_cpus) {
+               for_each_cpu_mask_nr(j, online_policy_cpus) {
                        freqs.cpu = j;
                        cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
                        cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
index 1b50244..191f726 100644 (file)
@@ -279,7 +279,7 @@ static int speedstep_target (struct cpufreq_policy *policy,
 
        cpus_allowed = current->cpus_allowed;
 
-       for_each_cpu_mask(i, policy->cpus) {
+       for_each_cpu_mask_nr(i, policy->cpus) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
        }
@@ -292,7 +292,7 @@ static int speedstep_target (struct cpufreq_policy *policy,
        /* allow to be run on all CPUs */
        set_cpus_allowed_ptr(current, &cpus_allowed);
 
-       for_each_cpu_mask(i, policy->cpus) {
+       for_each_cpu_mask_nr(i, policy->cpus) {
                freqs.cpu = i;
                cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
        }
index 26d615d..bfade33 100644 (file)
@@ -488,7 +488,7 @@ static void __cpuinit cache_remove_shared_cpu_map(unsigned int cpu, int index)
        int sibling;
 
        this_leaf = CPUID4_INFO_IDX(cpu, index);
-       for_each_cpu_mask(sibling, this_leaf->shared_cpu_map) {
+       for_each_cpu_mask_nr(sibling, this_leaf->shared_cpu_map) {
                sibling_leaf = CPUID4_INFO_IDX(sibling, index); 
                cpu_clear(cpu, sibling_leaf->shared_cpu_map);
        }
index 7c9a813..88736ca 100644 (file)
@@ -527,7 +527,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
        if (err)
                goto out_free;
 
-       for_each_cpu_mask(i, b->cpus) {
+       for_each_cpu_mask_nr(i, b->cpus) {
                if (i == cpu)
                        continue;
 
@@ -617,7 +617,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
 #endif
 
        /* remove all sibling symlinks before unregistering */
-       for_each_cpu_mask(i, b->cpus) {
+       for_each_cpu_mask_nr(i, b->cpus) {
                if (i == cpu)
                        continue;
 
index ef1a8df..e2838cb 100644 (file)
@@ -718,7 +718,7 @@ static int __assign_irq_vector(int irq, cpumask_t mask)
                        return 0;
        }
 
-       for_each_cpu_mask(cpu, mask) {
+       for_each_cpu_mask_nr(cpu, mask) {
                cpumask_t domain, new_mask;
                int new_cpu;
                int vector, offset;
@@ -739,7 +739,7 @@ next:
                        continue;
                if (vector == IA32_SYSCALL_VECTOR)
                        goto next;
-               for_each_cpu_mask(new_cpu, new_mask)
+               for_each_cpu_mask_nr(new_cpu, new_mask)
                        if (per_cpu(vector_irq, new_cpu)[vector] != -1)
                                goto next;
                /* Found one! */
@@ -749,7 +749,7 @@ next:
                        cfg->move_in_progress = 1;
                        cfg->old_domain = cfg->domain;
                }
-               for_each_cpu_mask(new_cpu, new_mask)
+               for_each_cpu_mask_nr(new_cpu, new_mask)
                        per_cpu(vector_irq, new_cpu)[vector] = irq;
                cfg->vector = vector;
                cfg->domain = domain;
@@ -781,7 +781,7 @@ static void __clear_irq_vector(int irq)
 
        vector = cfg->vector;
        cpus_and(mask, cfg->domain, cpu_online_map);
-       for_each_cpu_mask(cpu, mask)
+       for_each_cpu_mask_nr(cpu, mask)
                per_cpu(vector_irq, cpu)[vector] = -1;
 
        cfg->vector = 0;
index 3898849..fff8eba 100644 (file)
@@ -487,7 +487,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
        cpu_set(cpu, cpu_sibling_setup_map);
 
        if (smp_num_siblings > 1) {
-               for_each_cpu_mask(i, cpu_sibling_setup_map) {
+               for_each_cpu_mask_nr(i, cpu_sibling_setup_map) {
                        if (c->phys_proc_id == cpu_data(i).phys_proc_id &&
                            c->cpu_core_id == cpu_data(i).cpu_core_id) {
                                cpu_set(i, per_cpu(cpu_sibling_map, cpu));
@@ -510,7 +510,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)
                return;
        }
 
-       for_each_cpu_mask(i, cpu_sibling_setup_map) {
+       for_each_cpu_mask_nr(i, cpu_sibling_setup_map) {
                if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
                    per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
                        cpu_set(i, c->llc_shared_map);
@@ -1298,7 +1298,7 @@ static void remove_siblinginfo(int cpu)
        int sibling;
        struct cpuinfo_x86 *c = &cpu_data(cpu);
 
-       for_each_cpu_mask(sibling, per_cpu(cpu_core_map, cpu)) {
+       for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) {
                cpu_clear(cpu, per_cpu(cpu_core_map, sibling));
                /*/
                 * last thread sibling in this cpu core going down
@@ -1307,7 +1307,7 @@ static void remove_siblinginfo(int cpu)
                        cpu_data(sibling).booted_cores--;
        }
 
-       for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu))
+       for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu))
                cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling));
        cpus_clear(per_cpu(cpu_sibling_map, cpu));
        cpus_clear(per_cpu(cpu_core_map, cpu));
index 94e6900..7a70638 100644 (file)
@@ -345,7 +345,7 @@ static void xen_send_IPI_mask(cpumask_t mask, enum ipi_vector vector)
 
        cpus_and(mask, mask, cpu_online_map);
 
-       for_each_cpu_mask(cpu, mask)
+       for_each_cpu_mask_nr(cpu, mask)
                xen_send_IPI_one(cpu, vector);
 }
 
@@ -413,7 +413,7 @@ int xen_smp_call_function_mask(cpumask_t mask, void (*func)(void *),
 
        /* Make sure other vcpus get a chance to run if they need to. */
        yield = false;
-       for_each_cpu_mask(cpu, mask)
+       for_each_cpu_mask_nr(cpu, mask)
                if (xen_vcpu_stolen(cpu))
                        yield = true;
 
index ecc80f3..5f7310a 100644 (file)
@@ -121,7 +121,7 @@ static inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
         * - mbligh
         */
        local_irq_save(flags);
-       for_each_cpu_mask(query_cpu, mask) {
+       for_each_cpu_mask_nr(query_cpu, mask) {
                __send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu),
                                      vector, APIC_DEST_PHYSICAL);
        }