From 6cf474d792d3197bdf92e49d4215c8bc942d6e15 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 21 Mar 2013 19:40:49 -0700 Subject: [PATCH] ofproto-dpif: Rate limit calls to facet_learn(). In the TCP_CRR benchmark, ovs-vswitchd spends so much time in update_stats() that it has a significant impact on flow setup performance. Further work is needed in this area, but for now, simply rate limiting facet_learn() has a roughly 10% improvement with complex flow tables. Signed-off-by: Ethan Jackson --- ofproto/ofproto-dpif.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 30094f6a7..915d2d01e 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -491,6 +491,8 @@ struct facet { * always be valid, since it could have been removed after newer * subfacets were pushed onto the 'subfacets' list.) */ struct subfacet one_subfacet; + + long long int learn_rl; /* Rate limiter for facet_learn(). */ }; static struct facet *facet_create(struct rule_dpif *, @@ -4376,6 +4378,8 @@ facet_create(struct rule_dpif *rule, const struct flow *flow, uint32_t hash) netflow_flow_init(&facet->nf_flow); netflow_flow_update_time(ofproto->netflow, &facet->nf_flow, facet->used); + facet->learn_rl = time_msec() + 500; + return facet; } @@ -4452,6 +4456,12 @@ facet_learn(struct facet *facet) struct subfacet, list_node); struct action_xlate_ctx ctx; + if (time_msec() < facet->learn_rl) { + return; + } + + facet->learn_rl = time_msec() + 500; + if (!facet->has_learn && !facet->has_normal && (!facet->has_fin_timeout -- 2.43.0