From nobody Thu Nov 09 14:35:26 2023 X-Original-To: dev-commits-src-main@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 4SR4Hf3krZz5184j; Thu, 9 Nov 2023 14:35:26 +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 4SR4Hf3GXMz3PD6; Thu, 9 Nov 2023 14:35:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699540526; 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=ZVCYwX/fAbmcNHOTTaPyHIiBJvxzbxVETE4jKJE7N+A=; b=gu7r89AmnPJTlotmpFLppaDQ/GR3ZFeGb4CyQPRJL6P9BVzjOOqgsMgMcr5pEcgKEBuw3p mHh1Vwr/5y1qCAU8l0uzVvmFIUijUKWJLZdyMNdzCRijXs/5JDUrchn+LYxkj/x58Zt2Oy a1myC8FbpqojacQv5K7lSxQ6vV4kSXI/7Jrn4z8p4rbuvycZoC1cFzO+3ph99Dazf7flyZ XT74jWRgLGh0vYvcH8uHZNqjIwvrtkJwlWjK1cC5qYsgtQwV8gvoQcaBH1yyqycYHQTWUO 9NND7n3ZFXdQgUVtHooe7AUTyIuRrXCmxehnS5YpKwclcMIBaaHUhESlr7SHEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699540526; 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=ZVCYwX/fAbmcNHOTTaPyHIiBJvxzbxVETE4jKJE7N+A=; b=ERI1Hq9pIkaQT1zpCYJphYSO7pB3W+HRKSYaSToYN4jnNGAi9/N7zNnBw6pSgp80HaQ0YM 1e0dVXl7t2vdaINxlsw05H7X3uHxi9sTOgmgvJINNtgKf9PsLGy0gqdpE/njZ071C+OVLH F8ZXgW7jU42GUUC1jcqG/pr2oSj3Msyin+xtAaOwyhw+mfGPIK4K3CP2Ut+MWAavsDnI4K LPYvKVb9SA2H0aiuvf4rJPdC0oR+bi8y6jNqTY3gE7j+e+xcJdF2lF3iSzsV6KVkm1Gt6C MK/bhNWSeZNsctHu+Xm8u0hotSkKidO9VPbzW+JDoorcii6AqkBIH3m8GWJzGA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699540526; a=rsa-sha256; cv=none; b=TEnPpsERovmlevFZOdr06Y4w5Z8Ixcfk10YmSpayBRpwpWDtr7sd0Mjh4fvw0DF1XTSdCW J1yggdAmiIZuwK+yR+Zb5V4nC8RPNI0PIDppSLweRSrkAnQ2rJ36x0Ew45cBDmrgB/530T sB4yTOh7upYeppqqb9lXSKQsk9ChPYijU3BJlTGfimYEB5jI+q/v/qTUBh4fiatcAfBm7a Cq/D1oczpf8zMxjQWaJId6Kv6TjpsXI9jvZlzxMx34C9ive0DQHDwNiWhYKblh9DIvBke1 mhyVvd9CY0/Q3jZ/oSSsgWDn3dDut3I6RJArVgH6F84yh1Dhwx0AOI3o66bgsw== 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 4SR4Hf2KGBz4R9; Thu, 9 Nov 2023 14:35:26 +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 3A9EZQHI063759; Thu, 9 Nov 2023 14:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A9EZQ28063756; Thu, 9 Nov 2023 14:35:26 GMT (envelope-from git) Date: Thu, 9 Nov 2023 14:35:26 GMT Message-Id: <202311091435.3A9EZQ28063756@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: 0d2ab4a4ced0 - main - pf: add hashtable row count SDT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 0d2ab4a4ced0f153a6b6a58ca3cfa6efbeeec7a2 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d2ab4a4ced0f153a6b6a58ca3cfa6efbeeec7a2 commit 0d2ab4a4ced0f153a6b6a58ca3cfa6efbeeec7a2 Author: Kristof Provost AuthorDate: 2023-11-09 12:39:56 +0000 Commit: Kristof Provost CommitDate: 2023-11-09 13:21:53 +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 --- 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);