ofproto: Optimise OpenFlow flow expiry
authorSimon Horman <horms@verge.net.au>
Tue, 15 Jan 2013 04:20:57 +0000 (13:20 +0900)
committerBen Pfaff <blp@nicira.com>
Fri, 25 Jan 2013 17:53:02 +0000 (09:53 -0800)
commite503cc1993970ef27882a9b922efbd365d9da2be
treed7f6ac762078c6d9760950c74db3349c3f47b803
parent4766ce7a6438c11743c354fddad9d1164c76c467
ofproto: Optimise OpenFlow flow expiry

Optimise OpenFlow flow expiry by placing expirable flows on a list.
This optimises scanning of flows for expiry in two ways:

* Flows that will never expire are not traversed.

  This addresses a case seen in the field.  With 1,000,000 flows that
  are not expirable, this dramatically reduces CPU utilization to
  approximately zero.

* Empirically list traversal appears faster than the code it replaces.

  With 1,000,000 expirable flows present an otherwise idle system I
  observed CPU utilisation of around 20% with the existing code but
  around 10% with this new code.

Signed-off-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto-dpif.c
ofproto/ofproto-provider.h
ofproto/ofproto.c