[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20150428.124600.1101490852444899111.davem@davemloft.net>
Date: Tue, 28 Apr 2015 12:46:00 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: rusty@...tcorp.com.au
Cc: amirv@...lanox.com, linux-kernel@...r.kernel.org,
geert@...ux-m68k.org
Subject: Re: [RFC (untested)] cpumask_set_cpu_local_first =>
cpumask_local_spread, lament
From: Rusty Russell <rusty@...tcorp.com.au>
Date: Tue, 28 Apr 2015 15:29:45 +0930
> da91309e0a7e (cpumask: Utility function to set n'th cpu...) created a
> genuinely weird function. I never saw it before, it went through DaveM.
> (He only does this to make us other maintainers feel better about our own
> mistakes.)
>
> cpumask_set_cpu_local_first's purpose is say "I need to spread things
> across N online cpus, choose the ones on this numa node first"; you call
> it in a loop.
>
> It can fail. One of the two callers ignores this, the other aborts and
> fails the device open.
>
> It can fail in two ways: allocating the off-stack cpumask, or through a
> convoluted codepath which AFAICT can only occur if cpu_online_mask
> changes. Which shouldn't happen, because if cpu_online_mask can change
> while you call this, it could return a now-offline cpu anyway.
>
> It contains a nonsensical test "!cpumask_of_node(numa_node)". This was
> drawn to my attention by Geert, who said this causes a warning on Sparc.
> It sets a single bit in a cpumask instead of returning a cpu number,
> because that's what the callers want.
>
> It could be made more efficient by passing the previous cpu rather than
> an index, but that would be more invasive to the callers.
>
> Fixes: da91309e0a7e8966d916a74cce42ed170fde06bf
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
Acked-by: David S. Miller <davem@...emloft.net>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists