[ovs-dev] [optimize 22/26] ofproto-dpif: Avoid malloc() in common case for "execute" operations.

Ben Pfaff blp at nicira.com
Wed Apr 18 23:59:03 UTC 2012


On Wed, Apr 18, 2012 at 01:21:17PM -0700, Ethan Jackson wrote:
> On Wed, Apr 18, 2012 at 11:30, Ethan Jackson <ethan at nicira.com> wrote:
> > The addition of the ofpbuf stubs is a really useful optimization, but
> > it makes the memory management a bit more difficult to work out
> > conceptually, so please excuse me if my following comment is
> > misguided:
> >
> > It looks to me like handle_flow_miss() can populate elements of
> > 'ops->dpif_op.u.execute' with odp_actions.data which could be
> > allocated on the stack.  This data is then used by the caller of
> > handle_flow_miss() in its call to dpif_operate().  Also, it seems to
> > me that more than one packet could have its dpif_execute actions
> > populated from the same stack allocated odp_actions buffer.  Again, I
> > may be reading the code wrong, so if you think it's correct feel free
> > to ignore.
> 
> Ah I think I get it now, I think you intended to use the stub in
> struct flow_miss_op instead of allocating one on the stack.  The next
> patch in the series fixes the problem.  May as well fix it here as
> too.

Yeah, that's right.  Good catch.

I fixed up this patch to use ->stub.



More information about the dev mailing list