mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
pf: getstates: avoid taking the hashrow lock if the row is empty
Reviewed by: mjg
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30946
(cherry picked from commit a19ff8ce9b)
This commit is contained in:
parent
9e5d987058
commit
1882bdd192
1 changed files with 4 additions and 0 deletions
|
|
@ -5055,6 +5055,10 @@ pf_getstates(struct pfioc_nv *nv)
|
|||
for (int i = 0; i < pf_hashmask; i++) {
|
||||
struct pf_idhash *ih = &V_pf_idhash[i];
|
||||
|
||||
/* Avoid taking the lock if there are no states in the row. */
|
||||
if (LIST_EMPTY(&ih->states))
|
||||
continue;
|
||||
|
||||
PF_HASHROW_LOCK(ih);
|
||||
LIST_FOREACH(s, &ih->states, entry) {
|
||||
if (s->timeout == PFTM_UNLINKED)
|
||||
|
|
|
|||
Loading…
Reference in a new issue