All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
To: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Cc: lttng-dev@lists.lttng.org, jgalar@efficios.com
Subject: Re: [PATCH lttng-tools] Perform local data pending before checking data pending with relayd
Date: Wed, 19 Sep 2018 11:52:35 -0400	[thread overview]
Message-ID: <20180919155233.GB2836__39034.7273358659$1537372248$gmane$org@gmail.com> (raw)
In-Reply-To: <20180911000915.29177-5-jonathan.rajotte-julien@efficios.com>

Merged in master, stable-2.11, stable-2.10, and stable-2.9.

Thanks,
Jérémie

On Mon, Sep 10, 2018 at 08:09:15PM -0400, Jonathan Rajotte wrote:
> Performing the data pending check in two phases, local and network,
> reduce the total number network operation needed.
> 
> Doing the local check first enable early return in cases where data is
> still pending locally.
> 
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
> ---
>  src/common/consumer/consumer.c | 52 ++++++++++++++++++----------------
>  1 file changed, 28 insertions(+), 24 deletions(-)
> 
> diff --git a/src/common/consumer/consumer.c b/src/common/consumer/consumer.c
> index 66f10c780..5a32c7e8b 100644
> --- a/src/common/consumer/consumer.c
> +++ b/src/common/consumer/consumer.c
> @@ -3734,19 +3734,6 @@ int consumer_data_pending(uint64_t id)
>  	/* Ease our life a bit */
>  	ht = consumer_data.stream_list_ht;
>  
> -	relayd = find_relayd_by_session_id(id);
> -	if (relayd) {
> -		/* Send init command for data pending. */
> -		pthread_mutex_lock(&relayd->ctrl_sock_mutex);
> -		ret = relayd_begin_data_pending(&relayd->control_sock,
> -				relayd->relayd_session_id);
> -		pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
> -		if (ret < 0) {
> -			/* Communication error thus the relayd so no data pending. */
> -			goto data_not_pending;
> -		}
> -	}
> -
>  	cds_lfht_for_each_entry_duplicate(ht->ht,
>  			ht->hash_fct(&id, lttng_ht_seed),
>  			ht->match_fct, &id,
> @@ -3769,9 +3756,27 @@ int consumer_data_pending(uint64_t id)
>  			}
>  		}
>  
> -		/* Relayd check */
> -		if (relayd) {
> -			pthread_mutex_lock(&relayd->ctrl_sock_mutex);
> +		pthread_mutex_unlock(&stream->lock);
> +	}
> +
> +	relayd = find_relayd_by_session_id(id);
> +	if (relayd) {
> +		unsigned int is_data_inflight = 0;
> +
> +		/* Send init command for data pending. */
> +		pthread_mutex_lock(&relayd->ctrl_sock_mutex);
> +		ret = relayd_begin_data_pending(&relayd->control_sock,
> +				relayd->relayd_session_id);
> +		if (ret < 0) {
> +			pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
> +			/* Communication error thus the relayd so no data pending. */
> +			goto data_not_pending;
> +		}
> +
> +		cds_lfht_for_each_entry_duplicate(ht->ht,
> +				ht->hash_fct(&id, lttng_ht_seed),
> +				ht->match_fct, &id,
> +				&iter.iter, stream, node_session_id.node) {
>  			if (stream->metadata_flag) {
>  				ret = relayd_quiescent_control(&relayd->control_sock,
>  						stream->relayd_stream_id);
> @@ -3780,20 +3785,19 @@ int consumer_data_pending(uint64_t id)
>  						stream->relayd_stream_id,
>  						stream->next_net_seq_num - 1);
>  			}
> -			pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
>  			if (ret == 1) {
> +				pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
>  				pthread_mutex_unlock(&stream->lock);
>  				goto data_pending;
>  			}
> +			if (ret < 0) {
> +				pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
> +				pthread_mutex_unlock(&stream->lock);
> +				goto data_not_pending;
> +			}
>  		}
> -		pthread_mutex_unlock(&stream->lock);
> -	}
>  
> -	if (relayd) {
> -		unsigned int is_data_inflight = 0;
> -
> -		/* Send init command for data pending. */
> -		pthread_mutex_lock(&relayd->ctrl_sock_mutex);
> +		/* Send end command for data pending. */
>  		ret = relayd_end_data_pending(&relayd->control_sock,
>  				relayd->relayd_session_id, &is_data_inflight);
>  		pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
> -- 
> 2.17.1
> 
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

  parent reply	other threads:[~2018-09-19 15:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180911000915.29177-1-jonathan.rajotte-julien@efficios.com>
2018-09-11  0:09 ` [PATCH lttng-tools] Fix: acquire stream lock during kernel metadata snapshot Jonathan Rajotte
2018-09-11  0:09 ` [PATCH lttng-tools] Fix: Skip uid registry when metadata key is 0 Jonathan Rajotte
2018-09-11  0:09 ` [PATCH lttng-tools] Fix: Holding the stream lock does not equate to having data pending Jonathan Rajotte
2018-09-11  0:09 ` [PATCH lttng-tools] Perform local data pending before checking data pending with relayd Jonathan Rajotte
2018-09-19 15:52 ` [PATCH lttng-tools] Fix: double put on error path Jérémie Galarneau
     [not found] ` <20180911000915.29177-5-jonathan.rajotte-julien@efficios.com>
2018-09-19 15:52   ` Jérémie Galarneau [this message]
     [not found] ` <20180911000915.29177-4-jonathan.rajotte-julien@efficios.com>
2018-09-19 15:53   ` [PATCH lttng-tools] Fix: Holding the stream lock does not equate to having data pending Jérémie Galarneau
     [not found] ` <20180911000915.29177-3-jonathan.rajotte-julien@efficios.com>
2018-09-19 15:53   ` [PATCH lttng-tools] Fix: Skip uid registry when metadata key is 0 Jérémie Galarneau
     [not found] ` <20180911000915.29177-2-jonathan.rajotte-julien@efficios.com>
2018-09-19 15:54   ` [PATCH lttng-tools] Fix: acquire stream lock during kernel metadata snapshot Jérémie Galarneau

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='20180919155233.GB2836__39034.7273358659$1537372248$gmane$org@gmail.com' \
    --to=jeremie.galarneau@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=jonathan.rajotte-julien@efficios.com \
    --cc=lttng-dev@lists.lttng.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.