Date: Thu, 16 Nov 2023 10:17:28 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: d9e3f1a5da21 - stable/13 - pf: add hashtable row count SDT Message-ID: <202311161017.3AGAHSnl085629@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d9e3f1a5da21b905c3e904643dc45e794eb842e6 commit d9e3f1a5da21b905c3e904643dc45e794eb842e6 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2023-11-09 12:39:56 +0000 Commit: Kristof Provost <kp@FreeBSD.org> CommitDate: 2023-11-16 08:40:14 +0000 pf: add hashtable row count SDT This allows us to figure out how many states each hashrow contains. That can be important to know when debugging performance issues. A simple probe could be: dtrace -n 'pf:purge:state:rowcount { @counts["states per row"] = quantize(arg1); }' dtrace: description 'pf:purge:state:rowcount ' matched 1 probe ^C states per row value ------------- Distribution ------------- count -1 | 0 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8257624 1 | 14321 2 | 0 MFC after: 1 week Sponsored by: Modirum MDPay (cherry picked from commit 0d2ab4a4ced0f153a6b6a58ca3cfa6efbeeec7a2) --- sys/netpfil/pf/pf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 7bac94f77a32..80f4a8fa0626 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -120,6 +120,7 @@ SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", "struct pf_kstate *"); SDT_PROBE_DEFINE4(pf, sctp, multihome, test, "struct pfi_kkif *", "struct pf_krule *", "struct mbuf *", "int"); +SDT_PROBE_DEFINE2(pf, purge, state, rowcount, "int", "size_t"); /* * Global variables @@ -2130,6 +2131,7 @@ pf_purge_expired_states(u_int i, int maxcheck) { struct pf_idhash *ih; struct pf_kstate *s; + size_t count; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -2137,6 +2139,7 @@ pf_purge_expired_states(u_int i, int maxcheck) * Go through hash and unlink states that expire now. */ while (maxcheck > 0) { + count = 0; ih = &V_pf_idhash[i]; /* only take the lock if we expect to do work */ @@ -2157,10 +2160,13 @@ relock: s->kif->pfik_flags |= PFI_IFLAG_REFS; if (s->rt_kif) s->rt_kif->pfik_flags |= PFI_IFLAG_REFS; + count++; } PF_HASHROW_UNLOCK(ih); } + SDT_PROBE2(pf, purge, state, rowcount, i, count); + /* Return when we hit end of hash. */ if (++i > pf_hashmask) { V_pf_status.states = uma_zone_get_cur(V_pf_state_z);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202311161017.3AGAHSnl085629>