Skip to content

Commit

Permalink
core.packet: reorder group_fl released/reclaimed/unlocked events
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeneia committed Nov 8, 2018
1 parent edaad6c commit 9c4c804
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/packet.lua
Expand Up @@ -123,18 +123,18 @@ end

-- Return borrowed packets to group freelist.
function rebalance_freelists ()
local free_packets = freelist_nfree(packets_fl)
if group_fl and free_packets > packets_allocated then
if group_fl and freelist_nfree(packets_fl) > packets_allocated then
events.group_freelist_wait()
freelist_lock(group_fl)
events.group_freelist_locked()
local nfree0 = freelist_nfree(packets_fl)
while freelist_nfree(packets_fl) > packets_allocated
and not freelist_full(group_fl) do
freelist_add(group_fl, freelist_remove(packets_fl))
end
events.group_freelist_released(nfree0 - freelist_nfree(packets_fl))
freelist_unlock(group_fl)
events.group_freelist_unlocked()
events.group_freelist_released(free_packets - freelist_nfree(packets_fl))
end
end

Expand Down

0 comments on commit 9c4c804

Please sign in to comment.