lkml.org 
[lkml]   [2014]   [Feb]   [13]   [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/13/2014 11:14 PM, Oleg Nesterov wrote:
> On 02/12, Srivatsa S. Bhat wrote:
>>
>> On 02/11/2014 10:45 PM, Oleg Nesterov wrote:
>>>
>>> I am a bit confused... If we do this, why we can't simply turn
>>> cpu_add_remove_lock into rw_semaphore?
>
> [...snip...]
>
>> cpu_notifier_register_begin(); | Run in parallel
>> | with similar phases
>> for_each_online_cpu(cpu) | from other subsystems.
>> init_cpu(cpu); |
>>
>> /* Updates the cpu notifier chain. */
>> register_cpu_notifier(&foobar_cpu_notifier); ||| -- Must run serially
>
> Ah indeed, we can't use a single lock, thanks. Perhaps we can simply
> add a spinlock_t which only protects cpu_chain though, but I am not
> sure and currently this is off-topic anyway.
>

The problem with that would be that the chain invocations (during CPU hotplug)
would have to take the spinlock (to prevent running concurrently with chain
updaters). But unfortunately CPU hotplug notifier callbacks can sleep, so we
can't hold spinlocks while invoking them.

Regards,
Srivatsa S. Bhat



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