> The 'reason' was computed only when logging at level DBG.  However, if a
> node takes more than 'engine_compute_log_timeout_msec' to recompute, the
> log is generated at level INFO, resulting in:
> 
>   inc_proc_eng|INFO|node: northd, recompute ((null))
> 
> We now unconditionally compute 'reason'.  In theory it's a bit
> inefficient but given that the number of I-P nodes is bound and usually
> relatively low, there's no real performance hit while the code remains
> readable.
> 
> Fixes: e1041d9c0bad ("inc-proc-eng: use VLOG_INFO_RL for recompute time over 
> 500ms")
> Signed-off-by: Dumitru Ceara <[email protected]>

Acked-by: Lorenzo Bianconi <[email protected]>

> ---
>  lib/inc-proc-eng.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c
> index 7b43917006..575b774ae6 100644
> --- a/lib/inc-proc-eng.c
> +++ b/lib/inc-proc-eng.c
> @@ -354,14 +354,11 @@ engine_recompute(struct engine_node *node, bool allowed,
>                   const char *reason_fmt, ...)
>  {
>      char *reason = NULL;
> +    va_list reason_args;
>  
> -    if (VLOG_IS_DBG_ENABLED()) {
> -        va_list reason_args;
> -
> -        va_start(reason_args, reason_fmt);
> -        reason = xvasprintf(reason_fmt, reason_args);
> -        va_end(reason_args);
> -    }
> +    va_start(reason_args, reason_fmt);
> +    reason = xvasprintf(reason_fmt, reason_args);
> +    va_end(reason_args);
>  
>      if (!allowed) {
>          VLOG_DBG("node: %s, recompute (%s) aborted", node->name, reason);
> -- 
> 2.27.0
> 
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to