Messages in this thread | | | Date | Tue, 14 Apr 2020 12:28:10 -0400 | From | Steven Rostedt <> | Subject | Re: [PATCH 3/4] cpumask: Convert cpumask_any_but() to the new random function |
| |
On Tue, 14 Apr 2020 16:05:55 +0100 Qais Yousef <qais.yousef@arm.com> wrote:
> +int cpumask_any_but(const struct cpumask *srcp, unsigned int cpu) > +{ > + unsigned int i; > + > + cpumask_check(cpu); > + > + for_each_cpu(i, srcp) { > + i = cpumask_any(srcp);
Hmm, if the current CPU is the last CPU in the mask, and cpumask_any() happens to return it, what happens?
> + if (i != cpu) > + return i;
We loop again, and wouldn't i being the last CPU in the mask cause this loop to exit, and return nr_cpu_ids?
-- Steve
> + } > + > + return nr_cpu_ids; > +}
| |