Skip to content
  • Paolo Bonzini's avatar
    21b7cf9e
    rcu: handle forks safely · 21b7cf9e
    Paolo Bonzini authored
    
    
    After forking, only the calling thread is duplicated in the child process.
    The call_rcu thread has to be recreated in the child.  Exploit the fact
    that only one thread exists (same as when constructors run), and just redo
    the entire initialization to ensure the threads are in the proper state.
    
    The only additional things to do are emptying the list of threads
    registered with RCU, and unlocking the lock that was taken in the prepare
    callback (implementations are allowed to fail pthread_mutex_init()
    if the mutex is still locked).
    
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    21b7cf9e
    rcu: handle forks safely
    Paolo Bonzini authored
    
    
    After forking, only the calling thread is duplicated in the child process.
    The call_rcu thread has to be recreated in the child.  Exploit the fact
    that only one thread exists (same as when constructors run), and just redo
    the entire initialization to ensure the threads are in the proper state.
    
    The only additional things to do are emptying the list of threads
    registered with RCU, and unlocking the lock that was taken in the prepare
    callback (implementations are allowed to fail pthread_mutex_init()
    if the mutex is still locked).
    
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading