lkml.org 
[lkml]   [2015]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RFC][PATCH 09/13] hotplug: Replace hotplug lock with percpu-rwsem
    On Wed, Jun 24, 2015 at 03:50:49PM +0200, Oleg Nesterov wrote:
    > On 06/23, Peter Zijlstra wrote:
    > > If in one callchain we do:
    > >
    > > get_online_cpus();
    > > lock(A);
    > >
    > > in another we do:
    > >
    > > lock(A);
    > > get_online_cpus();
    > >
    > > lockdep will complain about the inverted lock order, however this is not
    > > a problem at all for recursive locks.
    >
    > Ah, but in this case lockdep is right. This is deadlockable because
    > with the new implementation percpu_down_write() blocks the new readers.
    > So this change just hides the valid warning.
    >
    > Just suppose that the 3rd CPU does percpu_down_write()->down_write()
    > right after the 2nd CPU (above) takes lock(A).
    >
    > I have to admit that I didn't realize that the code above is currently
    > correct... but it is.
    >
    > So we need percpu_down_write_dont_block_readers(). I already thought
    > about this before, I'll try to make the patch tomorrow on top of your
    > changes.
    >
    > This means that we do not need task_struct->cpuhp_ref, but we can't
    > avoid livelock we currently have: cpu_hotplug_begin() can never succeed
    > if the new readers come fast enough.

    I'm confused.. why isn't the read-in-read recursion good enough?


    \
     
     \ /
      Last update: 2015-06-24 16:41    [W:2.217 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site