On Wed, May 24, 2023 at 11:12:28AM +0200, Ihtisham ul Haq via dev wrote:
> Using cache improves performance of recomputation of lflows(by
> about 30%)
> 
> Exising lflow cache for `matches` and `expressions` is adopted
> to include `actions` as well.
> 
> Co-authored-by: Felix Huettner <felix.huettner@mail.schwarz>
> Signed-off-by: Felix Huettner <felix.huettner@mail.schwarz>
> Signed-off-by: Ihtisham ul Haq <ihtisham.ul_haq@mail.schwarz>

...

> diff --git a/controller/lflow.c b/controller/lflow.c
> index 0b071138d..5ca676ee8 100644
> --- a/controller/lflow.c
> +++ b/controller/lflow.c
> @@ -1078,14 +1078,23 @@ consider_logical_flow__(const struct 
> sbrec_logical_flow *lflow,
>      struct sset template_vars_ref = SSET_INITIALIZER(&template_vars_ref);
>      struct expr *prereqs = NULL;
> 
> -    if (!lflow_parse_actions(lflow, l_ctx_in, &template_vars_ref,
> -                             &ovnacts, &prereqs)) {
> -        ovnacts_free(ovnacts.data, ovnacts.size);
> -        ofpbuf_uninit(&ovnacts);
> -        store_lflow_template_refs(l_ctx_out->lflow_deps_mgr,
> -                                  &template_vars_ref, lflow);
> -        sset_destroy(&template_vars_ref);
> -        return;
> +    struct lflow_cache_value *lcv =
> +        lflow_cache_get(l_ctx_out->lflow_cache, &lflow->header_.uuid);
> +    enum lflow_cache_type lcv_type =
> +        lcv ? lcv->type : LCACHE_T_NONE;
> +
> +    if (lcv_type != LCACHE_T_NONE) {
> +        ovnacts = *ofpbuf_clone(lcv->actions);

Hi,

This is being flagged as a memory leak by LeakSanitiser.

Link: 
https://github.com/ovsrobot/ovn/actions/runs/5066318567/jobs/9095972982#step:6:4817

> +    } else {
> +        if (!lflow_parse_actions(lflow, l_ctx_in, &template_vars_ref,
> +                                 &ovnacts, &prereqs)) {
> +            ovnacts_free(ovnacts.data, ovnacts.size);
> +            ofpbuf_uninit(&ovnacts);
> +            store_lflow_template_refs(l_ctx_out->lflow_deps_mgr,
> +                                    &template_vars_ref, lflow);
> +            sset_destroy(&template_vars_ref);
> +            return;
> +        }
>      }
> 
>      struct lookup_port_aux aux = {
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to