Re: [patch 20/20] cpu/hotplug: Convert hotplug locking to percpu rwsem

From: Peter Zijlstra
Date: Mon Apr 17 2017 - 02:50:34 EST


On Sat, Apr 15, 2017 at 07:01:27PM +0200, Thomas Gleixner wrote:
> There are no more (known) nested calls to get_online_cpus() so it's
> possible to remove the nested call magic and convert the mutex to a
> percpu-rwsem, which speeds up get/put_online_cpus() significantly for the
> uncontended case.
>
> The contended case (write locked for hotplug operations) is slow anyway, so
> the slightly more expensive down_write of the percpu rwsem does not matter.

So the previous thing was reader biassed and thus prone to writer
starvation. So a slightly more expensive write path doesn't matter; esp.
as its now fair and provides a guarantee it will happen, unlike the
previous one.