On 07/10/14 at 05:29pm, Joe Stringer wrote:
> Converting the flow key and mask back into netlink format during flow
> dump is fairly expensive. By caching the netlink versions of these
> during flow setup, and copying the memory directly during flow dump, we
> are able to support up to 33% more flows in the datapath. Flow setup
> rate decreases by around 10%.

First of all, I love this idea a lot. We could make use of it in
various other non-OVS Netlink users as well where the objects are largely
static.

If I understand the code correctly the gain is only visible on
consecutive dumps of the same flow. How about constructing the cache
when you require it for the first time? That avoids the cost on flow
setup.

>  /* Called with ovs_mutex or RCU read lock. */
>  static int ovs_flow_cmd_fill_match(struct datapath *dp,
>                                  const struct sw_flow *flow,
> +                                const struct sk_buff *nl_cache,
>                                  struct sk_buff *skb)
>  {
>       struct nlattr *nla;
>       int err;
>  
> +     if (skb_tailroom(skb) < ovs_nl_match_size())
> +             goto nla_put_failure;

The check is not wrong but it would be semantically more correct to
put it into the branch below as the nla_ API does the tailroom check
as well.

> +     if (nl_cache)
> +             return skb_copy_bits(nl_cache, 0, skb_put(skb, nl_cache->len),
> +                                  nl_cache->len);
> +
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to