From nobody Thu Nov 16 10:17:09 2023 X-Original-To: dev-commits-src-branches@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 4SWGDP5NyKz50STW; Thu, 16 Nov 2023 10:17:09 +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 4SWGDP4gwXz4JtT; Thu, 16 Nov 2023 10:17:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700129829; 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=JvcCq2ERAIUrAXewqtb0uivL3ZSqizaNz0xCqy5Bvzc=; b=gezkx8QgT1pZvwlN8JlnPNyz4k1ONX4Ry1CqlIYNgsueR1s/7fwZlUfz9c5QqGtXEz/1Ca jzEW2AUkhR5pO58OO7AHLW5DpZv1AISIr9Aw6J2D0tA09uyJVxRQGza46lkdGxI1Ds+NKu 0bWe75PdZfjg6v9/+K7o3hry6XRpGXGITGmZIyQ/rR5znqgd2zsfOP2ebWiiiVYvRDu/aP 1adk4SCHkVGa0qrXaPLtV2lmDKNs1UBUDr7PfvOnYudlGTvCNwqzfwjgxn+jqxQ9ajQu1U d5QX6FJdZOERBZJaq3Ghake40vtQFSau/ojceiCvRRG3Na7676GmhO4kvdKMyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700129829; 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=JvcCq2ERAIUrAXewqtb0uivL3ZSqizaNz0xCqy5Bvzc=; b=xkzY7Tu3Q0ZTjkyPzERARlul6aKHwR3CLdDMx1aXDejsLFn36ENDs2/a5aDqH7QDpgCt9o O5u5dutezJxwlzAtHaBqQhhK1ZklmQGrirmSxtuTO8eY723uISL3SjooEU5hmF4Ktk40Lh hdzYY/Ftbqg5XsVK8e/6AyqfAaNlYfAK21zU6ohG0aRRl1cpLmT7/OBdhINHcKrQoo3rIW ldgb8bqZBmHMxDSiezMNWuC28t8+JrXKVnAF+5LcDpC7rmOZHU72ppmK0EwMXiglbMZZSf 15BfZ5o9Vo08h0mO7sch7UGi7RIsfyKDJQUQ4TdJjj3kfaAOU4oskZ4Czyybtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700129829; a=rsa-sha256; cv=none; b=B7eyVYLVzsYCPUDItDqz2E2pTSGw9ux+R8cFHBlBVSF6YS+Xye6grpvUyr4nPo4NeooDjA +RXobOZa2lze4fOD1T9VWUhHg/TGONYFqZCLEo03NPUi0jMTc1h7Be79jo6u5isTH4C4ZT GjWICv9R2vhcOO2RIQHVA/pqubQ52EV5154wgNv6UQW+u0j26joCBtJxtsHHSx8ZwcS9QK gRTQy3f4a/AdS60lPvZVhxzBqXzMxA/RjPWTuB57YywuaFo149ZwPJhzKwbS9D0lucean4 Ch3vI3bMoAlY2GXePGDVHxB/inJHv5/z2dV3G/xH07Om9ubxoqylUtPWWKbgmw== 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 4SWGDP3l1wzwfK; Thu, 16 Nov 2023 10:17:09 +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 3AGAH9Fh085459; Thu, 16 Nov 2023 10:17:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3AGAH9QE085456; Thu, 16 Nov 2023 10:17:09 GMT (envelope-from git) Date: Thu, 16 Nov 2023 10:17:09 GMT Message-Id: <202311161017.3AGAH9QE085456@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: c1f3f795d80d - stable/14 - pf: add hashtable row count SDT List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/14 X-Git-Reftype: branch X-Git-Commit: c1f3f795d80dab4d0ab1ea213252a96735d99a24 Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c1f3f795d80dab4d0ab1ea213252a96735d99a24 commit c1f3f795d80dab4d0ab1ea213252a96735d99a24 Author: Kristof Provost AuthorDate: 2023-11-09 12:39:56 +0000 Commit: Kristof Provost CommitDate: 2023-11-16 08:39:45 +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 4990dce653b1..d5a9583d83f8 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -137,6 +137,7 @@ SDT_PROBE_DEFINE3(pf, eth, test_rule, mismatch, SDT_PROBE_DEFINE2(pf, eth, test_rule, match, "int", "struct pf_keth_rule *"); SDT_PROBE_DEFINE2(pf, eth, test_rule, final_match, "int", "struct pf_keth_rule *"); +SDT_PROBE_DEFINE2(pf, purge, state, rowcount, "int", "size_t"); /* * Global variables @@ -2174,6 +2175,7 @@ pf_purge_expired_states(u_int i, int maxcheck) struct pf_idhash *ih; struct pf_kstate *s; struct pf_krule_item *mrm; + size_t count; V_pf_status.states = uma_zone_get_cur(V_pf_state_z); @@ -2181,6 +2183,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 */ @@ -2203,10 +2206,13 @@ relock: mrm->r->rule_ref |= PFRULE_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);