mirror of https://github.com/OISF/suricata
flow: lockless flow manager checks
Until this point, the flow manager would check for timed out flows by walking the flow hash, locking first the hash row and then each individual flow to get it's state and timestamp. To not be too intrusive trylocks were used so that a busy flow wouldn't cause the flow manager to wait for a long time while holding the hash row lock. Building on the changes in handling of the flow state and lastts fields, this patch changes the flow managers behavior. It can now get a flows state atomically and the lastts can be safely read while holding just the flow hash row lock. This allows the flow manager to do the basic time out check much more cheaply: 1. it doesn't have to wait for getting a lock 2. it doesn't interupt the packet path As a consequence the trylock is now also gone. A flow that returns 'true' on timeout is pretty much certainly not going to be busy so we can safely lock it unconditionally. This also means the flow manager now walks the entire row unconditionally and is guaranteed to inspect each flow in the row. To make sure the functions called before the flow lock don't accidentally change the flow (which would require a lock) the args to these flows are changed to const pointers.pull/1315/head
parent
5587372ce1
commit
5251ea9ff5
Loading…
Reference in New Issue