From nobody Sun Aug 10 05:55:31 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 4c06SM6Skpz63sgK; Sun, 10 Aug 2025 05:55:31 +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 4c06SM5n71z3PtS; Sun, 10 Aug 2025 05:55:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754805331; 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=tisaShUo4wy62tK4N47qE3TB96ZSpktTK6OOXd8OyY0=; b=PQBLUfzLZkBbdvdtU6Lgy8nanCocRll1c2H4q1PrZQhOILcdP6hiSlZ25ifrxt1VwWzS5s XpC28R6Vrt8RsxcDh866iQv9ETRTrjySYJ0n4PDYcHNMe1a9mv8R6/y+RhbQwP7IqWQG+k IKuIr0u3/+Ni0OWS62RYQdninMuStcxhghZgLIUaWcjTWsTFZIo8c8k4FUsZg2CVf40KYC SUij9aEJgY8SuD5c8LakxgS+gxfLxQrqcNAlZTR1OFbZCo+en/Y49biuOOdzPyDGZdjTGd JzxJe4lgoH83sCxaaNTUlhZl2YK4gqtXLhbhCz3VWYvixabnQocPyKcnx0aOnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754805331; 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=tisaShUo4wy62tK4N47qE3TB96ZSpktTK6OOXd8OyY0=; b=ElP9IyXeQVwe7MKYZMbAywyjAuMCtwf0sKlA6701Li3cWFMJi0QEh0wkRkXcCaspKuDGrZ x1K67kEKMJ0r+rRiBc3+fTRtTr0u8Yuet4bUr06zEqJtNfQqeuX029PKEXbi1ksU6BG2HT AUHhH4u1U8H00ucwNDDVkktTIrhxdvcU2G5e12Q20JR8IKCFiVjs6Fe9lx8LWXDBqv41a+ kk8QhjSd0dVck2S6Xcj+ERpd4pzvAGmSBwpoUXp/PRdUytwOiLVCJ611sXgD3Ip/tiqvPg ETGWD/TdB9Ovp97hhiHcqbnpV382XeIHnVk1tphw1fpqaoXKq1tbcvKleOE8aQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754805331; a=rsa-sha256; cv=none; b=aYv7ylxcm7gBY8xPSNCtwu7Qae6+SawEXfauRmkr7y5wGvRZQxOXSSbXzVsFsZhi+egKx+ X6itpvOJKb5CKmJbWO/2Lba4/hTGiGKkwT0Fwx1OlYSz8UJpzqOjJsMGbSerXkjoo02ZKs SxJkRh6JEF262LhqpCAn3RbkvsAjNDNQY3g1BKCf/v1rVMJxve3VsWQnmWFm7MDb+AJO3R es2vs3h7u9C2o7AqUalrIh0v6xJlx5h+nVT4HRJB+Os26iDH/4wlHrdMYSfviBHk8iGJBr taxPoWdhc1PNgjXKaVRGUj7CbN1l0R0c+rXSHmHYzfq1O6pgbsQzOAJ7HLDmLQ== 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 4c06SM518hzv5P; Sun, 10 Aug 2025 05:55:31 +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 57A5tVpS077534; Sun, 10 Aug 2025 05:55:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 57A5tV05077531; Sun, 10 Aug 2025 05:55:31 GMT (envelope-from git) Date: Sun, 10 Aug 2025 05:55:31 GMT Message-Id: <202508100555.57A5tV05077531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Cy Schubert Subject: git: 9c1615a1a141 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c1615a1a141c36c2486b0b5d3ea75bf182aea5f Auto-Submitted: auto-generated The branch stable/13 has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9c1615a1a141c36c2486b0b5d3ea75bf182aea5f commit 9c1615a1a141c36c2486b0b5d3ea75bf182aea5f Author: Cy Schubert AuthorDate: 2025-07-07 16:50:27 +0000 Commit: Cy Schubert CommitDate: 2025-08-10 05:55:13 +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. (cherry picked from commit cf9b6857545371ab5becc6a785c62bc844cb2f94) --- 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 76fde8622498..18ef46e25805 100644 --- a/sys/netpfil/ipfilter/netinet/fil.c +++ b/sys/netpfil/ipfilter/netinet/fil.c @@ -7459,6 +7459,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) && @@ -7467,10 +7471,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) { @@ -7482,6 +7482,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