On Wed, Jul 27, 2011 at 4:21 PM, Ben Pfaff <[email protected]> wrote: > Is there a practical, efficient way to keep flows on an LRU list or some > reasonable approximation to one? If so, then userspace could say "give > me all of the flows used since <time>" and the kernel could traverse the > list until it hits a flow that hasn't been used since <time> and stop. > > One way might be to do something like this. Keep track of the last time > a packet arriving for a flow caused it to be put on the front of the LRU > list. When a packet arrives for a flow and that counter is unset or > more than N jiffies old, move it to the front of the list. Then any > given flow couldn't cause more than a small amount of cache line > ping-pong trauma (not more than once every N jiffies).
I think that would work as long as you are willing to keep the granularity sufficiently low (1 second?). If you went down the path that Pravin was describing where you have independent flow tables for each CPU then you could keep a per-CPU LRU and avoid cache issues altogether. One thing is I think you would need to hold a lock on the list while reading it, which would block packet processing for the entire time that you're dumping flows. The bigger question to me is whether this is actually that useful. For aging, you actually want the flows that haven't been touched, so the inverse of this list. For other things like stats and bonding this is useful but I think that you could calculate the active flows as part of aging anyways. _______________________________________________ dev mailing list [email protected] http://openvswitch.org/mailman/listinfo/dev
