Skip to content

Commit

Permalink
[S390] cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpu…
Browse files Browse the repository at this point in the history
…mask_bits.

Impact: cleanup, futureproof

In fact, all cpumask ops will only be valid (in general) for bit
numbers < nr_cpu_ids.  So use that instead of NR_CPUS in various
places (I also updated the immediate sites to use the new cpumask_
operators).

This is always safe: no cpu number can be >= nr_cpu_ids, and
nr_cpu_ids is initialized to NR_CPUS at boot.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Rusty Russell authored and Martin Schwidefsky committed Mar 26, 2009
1 parent 6f7a321 commit 93632d1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions arch/s390/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ static int smp_rescan_cpus_sigp(cpumask_t avail)
{
int cpu_id, logical_cpu;

logical_cpu = first_cpu(avail);
if (logical_cpu == NR_CPUS)
logical_cpu = cpumask_first(&avail);
if (logical_cpu >= nr_cpu_ids)
return 0;
for (cpu_id = 0; cpu_id <= 65535; cpu_id++) {
if (cpu_known(cpu_id))
Expand All @@ -309,8 +309,8 @@ static int smp_rescan_cpus_sigp(cpumask_t avail)
continue;
cpu_set(logical_cpu, cpu_present_map);
smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
logical_cpu = next_cpu(logical_cpu, avail);
if (logical_cpu == NR_CPUS)
logical_cpu = cpumask_next(logical_cpu, &avail);
if (logical_cpu >= nr_cpu_ids)
break;
}
return 0;
Expand All @@ -322,8 +322,8 @@ static int smp_rescan_cpus_sclp(cpumask_t avail)
int cpu_id, logical_cpu, cpu;
int rc;

logical_cpu = first_cpu(avail);
if (logical_cpu == NR_CPUS)
logical_cpu = cpumask_first(&avail);
if (logical_cpu >= nr_cpu_ids)
return 0;
info = kmalloc(sizeof(*info), GFP_KERNEL);
if (!info)
Expand All @@ -344,8 +344,8 @@ static int smp_rescan_cpus_sclp(cpumask_t avail)
smp_cpu_state[logical_cpu] = CPU_STATE_STANDBY;
else
smp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
logical_cpu = next_cpu(logical_cpu, avail);
if (logical_cpu == NR_CPUS)
logical_cpu = cpumask_next(logical_cpu, &avail);
if (logical_cpu >= nr_cpu_ids)
break;
}
out:
Expand Down Expand Up @@ -591,7 +591,7 @@ static int __init setup_possible_cpus(char *s)

pcpus = simple_strtoul(s, NULL, 0);
cpu_possible_map = cpumask_of_cpu(0);
for (cpu = 1; cpu < pcpus && cpu < NR_CPUS; cpu++)
for (cpu = 1; cpu < pcpus && cpu < nr_cpu_ids; cpu++)
cpu_set(cpu, cpu_possible_map);
return 0;
}
Expand Down

0 comments on commit 93632d1

Please sign in to comment.