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
This commit is contained in:
parent
34285eefdd
commit
a19ff8ce9b
@ -5054,6 +5054,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…
x
Reference in New Issue
Block a user