From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] [PATCH lttng-tools 1/3] Fix: Add missing call rcu and read side lock
Date: Wed, 3 Oct 2012 12:28:41 -0400 [thread overview]
Message-ID: <20121003162841.GA21776@Krystal> (raw)
In-Reply-To: <1349279317-28056-1-git-send-email-dgoulet@efficios.com>
* David Goulet (dgoulet at efficios.com) wrote:
> Signed-off-by: David Goulet <dgoulet at efficios.com>
> ---
> src/common/consumer.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/src/common/consumer.c b/src/common/consumer.c
> index f01eb5d..7c3762e 100644
> --- a/src/common/consumer.c
> +++ b/src/common/consumer.c
> @@ -688,7 +688,9 @@ void consumer_del_channel(struct lttng_consumer_channel *channel)
> }
> }
>
> + rcu_read_lock();
> call_rcu(&channel->node.head, consumer_free_channel);
> + rcu_read_unlock();
this rcu read lock is useless.
> end:
> pthread_mutex_unlock(&consumer_data.lock);
> }
> @@ -1535,7 +1537,7 @@ static void destroy_stream_ht(struct lttng_ht *ht)
> ret = lttng_ht_del(ht, &iter);
> assert(!ret);
>
> - free(stream);
> + call_rcu(&stream->node.head, consumer_free_stream);
Good point. While you are there, please remove the bogus comment at the
top of destroy_stream_ht(). It does not take into account that
lttng_ht_del can trigger a concurrent resize (performed by call rcu
worker threads).
> }
> rcu_read_unlock();
>
> @@ -1635,7 +1637,9 @@ static void consumer_del_metadata_stream(struct lttng_consumer_stream *stream)
> consumer_del_channel(stream->chan);
> }
>
> - free(stream);
> + rcu_read_lock();
> + call_rcu(&stream->node.head, consumer_free_stream);
> + rcu_read_unlock();
call_rcu makes sense here, but not rcu read lock.
Thanks,
Mathieu
> }
>
> /*
> --
> 1.7.10.4
>
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
prev parent reply other threads:[~2012-10-03 16:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 15:48 David Goulet
2012-10-03 15:48 ` [lttng-dev] [PATCH lttng-tools 2/3] Add hash table argument to helper functions David Goulet
2012-10-03 16:29 ` Mathieu Desnoyers
2012-10-03 15:48 ` [lttng-dev] [PATCH lttng-tools 3/3] Fix: Stream allocation and insertion consistency David Goulet
2012-10-03 16:38 ` Mathieu Desnoyers
2012-10-03 16:42 ` David Goulet
2012-10-03 16:48 ` David Goulet
2012-10-03 17:06 ` Mathieu Desnoyers
2012-10-03 16:28 ` Mathieu Desnoyers [this message]
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=20121003162841.GA21776@Krystal \
--to=mathieu.desnoyers@efficios.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