From nobody Mon Jul 7 23:04:16 2025 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 4bbfv532pkz61T1Z; Mon, 07 Jul 2025 23:04:17 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bbfv50Z1nz3pdl; Mon, 07 Jul 2025 23:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751929457; 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=Tbawh58FbPyfZivPj7Nl1yvulM32omYdHJvGGypQ7yE=; b=VTLFv4WzWKy5o8hWK4Xx8l4gRBFoHwZEzq3HpkJpW13yQUmKCOgUmfYOVX2brGd6OJfUcn S5IorwsXDPBrosmrjUOOrAzPExhneg3ENUioRaxc5+8uRVrcsTyotKDY/ANCKyj1oufx2o vaOdoA1JFQ1sURBbIrabZFf8aVccGhrdcaRESqasxpLhjoBiUBJLNBHBXFDint+zAOXs6x xJG9Ycn+Baw53c5fM+zYpV9IPqmsMEZAhniuUChQ3AdZwCOopwk7IggHVqOjLVJUnByq7L 0W6NRtkCqUR7vwaSWeicxe4pXSIcAOXuBrfkuJ3UBco+RxHJ4txyUI+Hdz87hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1751929457; 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=Tbawh58FbPyfZivPj7Nl1yvulM32omYdHJvGGypQ7yE=; b=VikvsG2T6d6R2/6jIhy06QPSmXy442A1CQokD1gec3V6ZdhARawS1sLOowDeFec6ZzfWC+ phm6hUsAi0BFKEY1TCJ9/oqaF0R4lKhZvEe3xaeY8ub3TH+yFZl2//SHikjuOC+Nmprjsr WLOhqGAwaCLzEx4egYrG1BbNxH2m2dCUe/KKMIOq8rLb+9dgmDsaKXRzUDmlcDjI/Etb2o j/ybIzsoNXsFU8Fi8xPZAE3BgBoAOuVZh3kAZheWDh93om8IoFIWD0989kYGoej1MYRBcB EY6AI2b2ZR7OQQDGK3N29bTXd4dI8YD9+OE1g8i5m8obw/rj/ajd47B7RxjfEw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1751929457; a=rsa-sha256; cv=none; b=pgQdkUa34BcOPP5EGPzP5ZYnSOICaeSkZODszOkN8zsWsN4+FM8wAhvvApKYDGswFIlwbI Z9Cgb7Li46NDJCmSZOI+M/oHzo1mZz2rbaA/XnyCTlZKlLIpkpSg0VvwTxQwJDZ7G4/3WU EpeuW7CY5Ufe9+J1q1bKegNxrro3MKJoirEjKx+s5mdTKxtq9zZodsjOV8dDKjVKgdBP7h 2fxags6F6FWMPln8w7QclD9QWpVTrz2U4MveBh/2NbdGOtSjc+ANsxe4EGY1+BP1pcUoDK 0k9LWaUGGC+uXQyzWWVXUrOV8pGJLtB6XwO/IHXbWsu3CIs2TmUOXSPVatWL8g== 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 4bbfv505BSz19MN; Mon, 07 Jul 2025 23:04:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 567N4GEA025935; Mon, 7 Jul 2025 23:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 567N4G0L025932; Mon, 7 Jul 2025 23:04:16 GMT (envelope-from git) Date: Mon, 7 Jul 2025 23:04:16 GMT Message-Id: <202507072304.567N4G0L025932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: cf9b68575453 - main - Revert "ipfilter: Avoid allocating a new ipf token when not needed" 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cf9b6857545371ab5becc6a785c62bc844cb2f94 Auto-Submitted: auto-generated The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=cf9b6857545371ab5becc6a785c62bc844cb2f94 commit cf9b6857545371ab5becc6a785c62bc844cb2f94 Author: Cy Schubert AuthorDate: 2025-07-07 16:50:27 +0000 Commit: Cy Schubert CommitDate: 2025-07-07 23:03:00 +0000 Revert "ipfilter: Avoid allocating a new ipf token when not needed" malloc() outside of a write lock will reduce potential contention. MFC after: 3 days This reverts commit 7f5e3b9fa3d159b7f061b4d01a767cbe5d0527f3. --- sys/netpfil/ipfilter/netinet/fil.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/ipfilter/netinet/fil.c b/sys/netpfil/ipfilter/netinet/fil.c index 2a75190a3ec7..2a4feb17dbd3 100644 --- a/sys/netpfil/ipfilter/netinet/fil.c +++ b/sys/netpfil/ipfilter/netinet/fil.c @@ -7455,6 +7455,10 @@ ipf_token_find(ipf_main_softc_t *softc, int type, int uid, void *ptr) { ipftoken_t *it, *new; + KMALLOC(new, ipftoken_t *); + if (new != NULL) + bzero((char *)new, sizeof(*new)); + WRITE_ENTER(&softc->ipf_tokens); for (it = softc->ipf_token_head; it != NULL; it = it->ipt_next) { if ((ptr == it->ipt_ctx) && (type == it->ipt_type) && @@ -7463,10 +7467,6 @@ ipf_token_find(ipf_main_softc_t *softc, int type, int uid, void *ptr) } if (it == NULL) { - KMALLOC(new, ipftoken_t *); - if (new != NULL) - bzero((char *)new, sizeof(*new)); - it = new; new = NULL; if (it == NULL) { @@ -7478,6 +7478,11 @@ ipf_token_find(ipf_main_softc_t *softc, int type, int uid, void *ptr) it->ipt_type = type; it->ipt_ref = 1; } else { + if (new != NULL) { + KFREE(new); + new = NULL; + } + if (it->ipt_complete > 0) it = NULL; else