lkml.org 
[lkml]   [2020]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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;
> +}

\
 
 \ /
  Last update: 2020-04-14 18:29    [W:0.204 / U:0.512 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site