Only take a lock when we know that there is work to do.
When expiring states, we currently always take a lock, even when
the list is empty. We can check to see if the list is empty and
if it is, do not take a lock.
This is fine, as we'll check again in 10 seconds, and even if we
lost a race, it doesn't make sense for the state to immediately
On my Pine A64-LTS arm64 board, it dropped CPU usage of the pf
purge thread from 1.2% down to .28% CPU usage. This is on a system
where only kldload pf was done, and with out any rules loaded...
I'll be added additional testing from an active router...
This was inspired by the increase in cpu usage due to the recent
increase in hashsize.