From: pbonzini@redhat.com (Paolo Bonzini)
Subject: [ltt-dev] [PATCH 2/3] add rcu_thread_offline before rcu_unregister_thread
Date: Sat, 27 Feb 2010 16:57:05 +0100 [thread overview]
Message-ID: <1267286226-7489-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1267286226-7489-1-git-send-email-pbonzini@redhat.com>
As mentioned in the previous commit message, rcu_thread_offline
is useful to avoid deadlocks between rcu_unregister_thread and
synchronize_rcu. Just like in urcu-qsbr.c, put a thread offline
before it unregisters itself.
An additional benefit is that a thread can unregister itself and
register itself later without triggering the assertion in
rcu_register_thread().
Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
---
urcu.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/urcu.c b/urcu.c
index dee8b59..e82bf6c 100644
--- a/urcu.c
+++ b/urcu.c
@@ -383,6 +383,7 @@ void rcu_register_thread(void)
void rcu_unregister_thread(void)
{
+ _rcu_thread_offline();
mutex_lock(&rcu_gp_lock);
list_del(&rcu_reader.head);
mutex_unlock(&rcu_gp_lock);
--
1.6.6
next prev parent reply other threads:[~2010-02-27 15:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-27 15:57 [ltt-dev] [PATCH 0/3] Fixes for threads that are readers and writers, and lock-free queue example Paolo Bonzini
2010-02-27 15:57 ` [ltt-dev] [PATCH 1/3] add rcu_thread_{on, off}line to urcu-bp and urcu Paolo Bonzini
2010-02-27 15:57 ` Paolo Bonzini [this message]
2010-02-27 15:57 ` [ltt-dev] [PATCH 3/3] lock-free queue with RCU-based garbage collection Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267286226-7489-3-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox