From nobody Sat Sep 10 09:34:39 2022 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 4MPnkm1x80z4bZkF; Sat, 10 Sep 2022 09:34:40 +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 4MPnkm1M4Rz3Tdx; Sat, 10 Sep 2022 09:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662802480; 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=n1uUeWhmZ6Tsbl4w9Yh34c2qB7Mhgk31+7511ngwLaI=; b=we3hFKS0UtPuTXF4GrqYRUpZWpASgaIOEmaunzDJaF8fXzXGE/hHl4IxLt8XsZww+WU3h4 YxH+fnMkbsXn3Oy4NpKYZKHLjYyLtTkNxV4ZysOJsp1Xe2edZGxnEA/jYsrR0A0fpq4St7 VYQi/KIA/S0oAiHgar+w8cUwVhPtTrLoy6cOxsBocOd4a8ngfoDeZY4jLIjHaLcj7sPGD1 t05Q8/9Sc3BU6SjW7fwy2kS81Sc4LWGdUaS3U6/tXhbIf3I3QvJKny8AmXnY/ILw2guyDc Rf8oBDgEddOSVypXQkpXrrFJXjtoxss3axIsfnbJvqYYVIJKzppO0dSzkKqFNQ== 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 4MPnkm0DZNzGbb; Sat, 10 Sep 2022 09:34:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 28A9Ydqr064082; Sat, 10 Sep 2022 09:34:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 28A9YdHB064081; Sat, 10 Sep 2022 09:34:39 GMT (envelope-from git) Date: Sat, 10 Sep 2022 09:34:39 GMT Message-Id: <202209100934.28A9YdHB064081@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 29b4b63c5912 - main - ip_reass: optimize ipreass_drain_vnet() 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: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29b4b63c591224912997aa1ee0c5e2b5587be1b6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662802480; 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=n1uUeWhmZ6Tsbl4w9Yh34c2qB7Mhgk31+7511ngwLaI=; b=Y9w7oArYXTSTwoex1A1eM2QKKtKnDS6vJ1/hpWONAoMKsEbrWKMxhdXK1q0vQcRlK6tyIR sl1PTaO03DWdsx8ONl+EwggtCh5QimPeKL8jHf04TviflpqhvqboNM/ebyOJd0Au+K7Yv/ o5Twu6vilx4Lc+PzLJnsLI7ISjxsb0jdVTHm3RBu0iFgyyp9LT083dPYMRWoY4BfHq3ydg 8qNy81s0M3KL2ls7t0Ba4L7iiLmsCmfcFPR9TLi1FTAjt4vJqJR1Kk9C95JMoWPO4NyYoN j2ZANjRTv/xrB1XoMqQKfM8eKm56Cr/CFuwja6QigmGGW1G209pX8TK9lnI/sg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662802480; a=rsa-sha256; cv=none; b=oumGUQesumwKDAqP8hnUayEeG49Szw1YLl4jeknYzayFcxJC47rP57lLJ3F0qiHHfGyZce eZqifOKC2YAII9vflm5OQtjjFb/2e1sBFniJGQpUsV3HRew97gLKH1qdKWSSWm0pI3wEpV +ATdcw6sUJ3j1MOx/QPziALoEve+teb4ZV/idK8kelB+AkBdDJx8/mVZt0XtSxnD9CXXnO TLSEZ59CMNhz8ejI3RnQVgRtR6ld7PtPgDbOVA04+Kv+sHrjxJIuFhg7mjHKekIDufZBqo fdhOeBu4xI4ICZLpj/fD4RwwTdnPZTulsqGwoo2xeIIXlB30iJXWgMHXvqnLAw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=29b4b63c591224912997aa1ee0c5e2b5587be1b6 commit 29b4b63c591224912997aa1ee0c5e2b5587be1b6 Author: Gleb Smirnoff AuthorDate: 2022-09-10 09:11:39 +0000 Commit: Gleb Smirnoff CommitDate: 2022-09-10 09:17:15 +0000 ip_reass: optimize ipreass_drain_vnet() - Call ipreass_reschedule() only once per slot [1] - Aggregate stats and update them once Suggested by: jtl [1] --- sys/netinet/ip_reass.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/netinet/ip_reass.c b/sys/netinet/ip_reass.c index aa5c99a3624c..a10dff9c8acb 100644 --- a/sys/netinet/ip_reass.c +++ b/sys/netinet/ip_reass.c @@ -633,16 +633,27 @@ ipreass_reschedule(struct ipqbucket *bucket) static void ipreass_drain_vnet(void) { + u_int dropped = 0; for (int i = 0; i < V_ipq_hashsize; i++) { + bool resched; + IPQ_LOCK(i); - while(!TAILQ_EMPTY(&V_ipq[i].head)) - ipq_drop(&V_ipq[i], TAILQ_FIRST(&V_ipq[i].head)); + resched = !TAILQ_EMPTY(&V_ipq[i].head); + while(!TAILQ_EMPTY(&V_ipq[i].head)) { + struct ipq *fp = TAILQ_FIRST(&V_ipq[i].head); + + dropped += fp->ipq_nfrags; + ipq_free(&V_ipq[i], fp); + } + if (resched) + ipreass_reschedule(&V_ipq[i]); KASSERT(V_ipq[i].count == 0, ("%s: V_ipq[%d] count %d (V_ipq=%p)", __func__, i, V_ipq[i].count, V_ipq)); IPQ_UNLOCK(i); } + IPSTAT_ADD(ips_fragdropped, dropped); } /*