From nobody Thu Nov 16 10:17:28 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SWGDm5p6Kz50SG0; Thu, 16 Nov 2023 10:17:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SWGDm4xKkz4KbJ; Thu, 16 Nov 2023 10:17:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700129848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ziEMbxzMS4eztbPOgiixgm/5Il7+nDPa49IBictJ970=; b=yzFophipWA2UfX8xys/PNG8QHVK7EVcQ40mO8s7DsmXnrr2E/2/ZTD815ObfjLmRkE9A7w 2PbkA4pp0JOWR91zXcwJVxzAjcovuKVFSNNB7XHwAwzvCaBF2HcuacQvsSOubB3YhRJBQd eyu2+rTVaYZiKzZNy4+wvuxldfBwJWZzSD1dFXXJllikpCNa/aRRp0Iohwr6JI7BeHaHVB 9XSR0umzMGoGyQ4Br0889RmJ2jYnGCu1mVn7BVYyeerxdQhkSZw10tSnISBQHZlcOaIAsx 9o8uTTe2azd1+ZoAgO1nat+eJLyKZJRxX2iGZttdqKPlhaKSFl7yxggEsvbk+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700129848; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ziEMbxzMS4eztbPOgiixgm/5Il7+nDPa49IBictJ970=; b=qvhpAtZNx8T8Es5Y+GAPV7/5XGJhH8+9oyZlS/Ft6yhi2FLUpka2P/fRldDD0WgR2+goK+ e68Wl79g59oqPC6CVFPvdaC8NGUj/ONzlrv+bVpp8t0MEAIjBIeM8lZaiZ2cn8gVlpPzd6 fFpNbCkYN4s9bjDCt4uHb/HOwauf+mzo4PVZTEYTYYJx6eSQX8Sq5+mnM4btDNHvKAmlW6 T+M8CdBPeW3MNQfuLEZmQJzqjnWrAdQAaDvNqv/WRzLSjIQAChTYlIjTy/GUnfkZqofVGs lyFwu3qy8YD2QGe53zHlhRNKjhSVuQinNt/KDP+eaNlEdnFnTlS8WObRUJqC+A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700129848; a=rsa-sha256; cv=none; b=TVVh2/yG3+r62q5ejkf+OvCCxQPEglufqYJ5YvXKRVtPgFpUSu0YBFWwRJwqORydcom6T3 XWFUxIUIGTspy0DoAXVjXRiYLY5n/mj+PtLEJ6BX8wgAUshblGcA3mhwP1q/xAtlgeuIwM KkEYuKY1T0yNdNWqtx43mNkm+NyEgw1M4E7ry4XHub/4SJhfYYSgOmAAzVMI6XyMUduSN/ bYNewQhbQ7fxVoSqk+ZF1WTXRUXuLwl/FrXB5DpP93rF9R+pBT71z4x70xZyHdxQPwJwYe t5w9Gic1HvCGnvHgK/098f8vCtgb51KtRMD2NgfVbdLdNdZ5u0ptb2JwMl+a7w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SWGDm3zFTzvx0; Thu, 16 Nov 2023 10:17:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3AGAHShK085632; Thu, 16 Nov 2023 10:17:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AGAHSnl085629; Thu, 16 Nov 2023 10:17:28 GMT (envelope-from git) Date: Thu, 16 Nov 2023 10:17:28 GMT Message-Id: <202311161017.3AGAHSnl085629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d9e3f1a5da21 - stable/13 - pf: add hashtable row count SDT List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d9e3f1a5da21b905c3e904643dc45e794eb842e6 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d9e3f1a5da21b905c3e904643dc45e794eb842e6 commit d9e3f1a5da21b905c3e904643dc45e794eb842e6 Author: Kristof Provost AuthorDate: 2023-11-09 12:39:56 +0000 Commit: Kristof Provost 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);