From: Ethan Jackson Date: Thu, 21 Mar 2013 20:31:14 +0000 (-0700) Subject: ofproto-dpif: Rate limit facet_check_consistency() X-Git-Tag: sliver-openvswitch-1.10.90-1~10^2~29 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=4d2a0f3984ec9ab76467bb2ee06476513a4d8083 ofproto-dpif: Rate limit facet_check_consistency() With complex flow tables, facet_check_consistency() can be expensive enough to show up in flow setup performance benchmarks. In my testing this patch gives us a roughly 10% improvement in TCP_CRR and ovs-benchmark. Signed-off-by: Ethan Jackson --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b8db91dfd..30094f6a7 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -693,6 +693,7 @@ struct ofproto_dpif { struct hmap facets; struct hmap subfacets; struct governor *governor; + long long int consistency_rl; /* Revalidation. */ struct table_dpif tables[N_TABLES]; @@ -1250,6 +1251,7 @@ construct(struct ofproto *ofproto_) hmap_init(&ofproto->facets); hmap_init(&ofproto->subfacets); ofproto->governor = NULL; + ofproto->consistency_rl = LLONG_MIN; for (i = 0; i < N_TABLES; i++) { struct table_dpif *table = &ofproto->tables[i]; @@ -1474,10 +1476,13 @@ run(struct ofproto *ofproto_) mac_learning_run(ofproto->ml, &ofproto->backer->revalidate_set); /* Check the consistency of a random facet, to aid debugging. */ - if (!hmap_is_empty(&ofproto->facets) + if (time_msec() >= ofproto->consistency_rl + && !hmap_is_empty(&ofproto->facets) && !ofproto->backer->need_revalidate) { struct facet *facet; + ofproto->consistency_rl = time_msec() + 250; + facet = CONTAINER_OF(hmap_random_node(&ofproto->facets), struct facet, hmap_node); if (!tag_set_intersects(&ofproto->backer->revalidate_set,