lkml.org 
[lkml]   [2014]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 01/51] CPU hotplug: Provide lockless versions of callback registration functions
On 02/11, Srivatsa S. Bhat wrote:
>
> +static DECLARE_RWSEM(cpu_hotplug_rwsem);
> +
> +void cpu_notifier_register_begin(void)
> +{
> + down_read(&cpu_hotplug_rwsem);
> +}
> +
> +void cpu_notifier_register_end(void)
> +{
> + up_read(&cpu_hotplug_rwsem);
> +}
> +
> /* Serializes the updates to cpu_online_mask, cpu_present_mask */
> static DEFINE_MUTEX(cpu_add_remove_lock);
>
> @@ -32,12 +45,14 @@ static DEFINE_MUTEX(cpu_add_remove_lock);
> */
> void cpu_maps_update_begin(void)
> {
> + down_write(&cpu_hotplug_rwsem);
> mutex_lock(&cpu_add_remove_lock);
> }
>
> void cpu_maps_update_done(void)
> {
> mutex_unlock(&cpu_add_remove_lock);
> + up_write(&cpu_hotplug_rwsem);
> }

I am a bit confused... If we do this, why we can't simply turn
cpu_add_remove_lock into rw_semaphore?

Oleg.



\
 
 \ /
  Last update: 2014-02-12 03:41    [W:0.620 / U:1.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site