diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2016-03-25 14:00:51 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-08-08 10:40:19 +0200 |
commit | 2a96a552f9502ac34c29da2f3a39788db5ee5692 (patch) | |
tree | e42372e2e5b2f73900092848f19463e9f0a7441d /util/rcu.c | |
parent | 73c6e4013b4cd92d3d531bc22cc29e6036ef42e0 (diff) |
Revert "rcu: do not create thread in pthread_atfork callback"
This reverts commit a59629fcc6f603e19b516dc08f75334e5c480bd0.
This is not needed anymore because the IOThread mutex is not
"magic" anymore (need not kick the CPU thread)and also because
fork callbacks are only enabled at the very beginning of
QEMU's execution.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'util/rcu.c')
-rw-r--r-- | util/rcu.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/util/rcu.c b/util/rcu.c index 2142ddd93b..ca5a63e36a 100644 --- a/util/rcu.c +++ b/util/rcu.c @@ -350,18 +350,22 @@ static void rcu_init_unlock(void) qemu_mutex_unlock(&rcu_registry_lock); qemu_mutex_unlock(&rcu_sync_lock); } -#endif -void rcu_after_fork(void) +static void rcu_init_child(void) { + if (atfork_depth < 1) { + return; + } + memset(®istry, 0, sizeof(registry)); rcu_init_complete(); } +#endif static void __attribute__((__constructor__)) rcu_init(void) { #ifdef CONFIG_POSIX - pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_unlock); + pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child); #endif rcu_init_complete(); } |