From: Joe Stringer Date: Wed, 2 Jul 2014 07:41:33 +0000 (+0000) Subject: revalidator: Improve optimization to skip revalidation. X-Git-Tag: v2.3~40 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=860428109084ee4f282eeaa155078c876a45e097 revalidator: Improve optimization to skip revalidation. The should_revalidate() optimisation introduced with commit 698ffe3623 (revalidator: Only revalidate high-throughput flows.) was a little aggressive, occasionally deleting flows even when OVS is quite capable of performing full revalidation. This commit modifies the logic to: * Firstly, check if we are likely to handle full revalidation, and attempt that instead. * Secondly, fall back to the existing flow throughput estimations to determine whether to revalidate the flow or just delete it. VMware-BZ: #1271926 Signed-off-by: Joe Stringer Acked-by: Alex Wang --- diff --git a/ofproto/ofproto-dpif-upcall.c b/ofproto/ofproto-dpif-upcall.c index a1262108e..74d9686e1 100644 --- a/ofproto/ofproto-dpif-upcall.c +++ b/ofproto/ofproto-dpif-upcall.c @@ -1175,10 +1175,16 @@ ukey_delete(struct revalidator *revalidator, struct udpif_key *ukey) } static bool -should_revalidate(uint64_t packets, long long int used) +should_revalidate(const struct udpif *udpif, uint64_t packets, + long long int used) { long long int metric, now, duration; + if (udpif->dump_duration < 200) { + /* We are likely to handle full revalidation for the flows. */ + return true; + } + /* Calculate the mean time between seeing these packets. If this * exceeds the threshold, then delete the flow rather than performing * costly revalidation for flows that aren't being hit frequently. @@ -1194,10 +1200,11 @@ should_revalidate(uint64_t packets, long long int used) duration = now - used; metric = duration / packets; - if (metric > 200) { - return false; + if (metric < 200) { + /* The flow is receiving more than ~5pps, so keep it. */ + return true; } - return true; + return false; } static bool @@ -1237,7 +1244,7 @@ revalidate_ukey(struct udpif *udpif, struct udpif_key *ukey, : 0; if (udpif->need_revalidate && last_used - && !should_revalidate(push.n_packets, last_used)) { + && !should_revalidate(udpif, push.n_packets, last_used)) { ok = false; goto exit; }