[ovs-dev] [PATCH v3 ovn 3/4] controller: add memory accounting for local_datapath

Lorenzo Bianconi lorenzo.bianconi at redhat.com
Thu Oct 14 10:34:35 UTC 2021


> On 9/25/21 12:19 AM, Lorenzo Bianconi wrote:
> > Similar to if-status-mgr, track memory allocated for local_datapath.
> > 
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi at redhat.com>
> > ---
> 
> Hi Lorenzo,
> 
> >  controller/binding.c        |  3 +++
> >  controller/local_data.c     | 50 +++++++++++++++++++++++++++++++++++++
> >  controller/local_data.h     |  3 +++
> >  controller/ovn-controller.c |  1 +
> >  4 files changed, 57 insertions(+)
> > 
> > diff --git a/controller/binding.c b/controller/binding.c
> > index c037b2352..661b4bb24 100644
> > --- a/controller/binding.c
> > +++ b/controller/binding.c
> > @@ -374,6 +374,8 @@ update_ld_external_ports(const struct sbrec_port_binding *binding_rec,
> >      struct local_datapath *ld = get_local_datapath(
> >          local_datapaths, binding_rec->datapath->tunnel_key);
> >      if (ld) {
> > +        local_datapath_ext_port_mem_update(ld, binding_rec->logical_port,
> > +                                           false);
> >          shash_replace(&ld->external_ports, binding_rec->logical_port,
> >                        binding_rec);
> >      }
> > @@ -1756,6 +1758,7 @@ remove_pb_from_local_datapath(const struct sbrec_port_binding *pb,
> >              ld->localnet_port = NULL;
> >          }
> >      } else if (!strcmp(pb->type, "external")) {
> > +        local_datapath_ext_port_mem_update(ld, pb->logical_port, true);
> >          shash_find_and_delete(&ld->external_ports, pb->logical_port);
> >      }
> >  }
> 
> I think the better way of doing this is to add functions to local_data.c
> for external ports too.  We have something similar for peer ports:
> 
> add_local_datapath_peer_port()
> remove_local_datapath_peer_port()
> 
> We can create new ones in local_data.c:
> 
> add_local_datapath_external_port()
> remove_local_datapath_external_port()
> 
> And also do the memory accounting there.  Like that we don't have to
> expose local_datapath_ext_port_mem_update(), it can be internal inside
> the local_data.c module.

ack, I will fix add them in v4.

Regards,
Lorenzo

> 
> Regards,
> Dumitru
> 


More information about the dev mailing list