From owner-dev-commits-src-main@freebsd.org Thu Apr 8 17:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B7265BA7AD; Thu, 8 Apr 2021 17:59:02 +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 4FGTXk0L3hz3qvl; Thu, 8 Apr 2021 17:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 F2FBB6B49; Thu, 8 Apr 2021 17:59:01 +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 138Hx1AR022689; Thu, 8 Apr 2021 17:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Hx1c7022688; Thu, 8 Apr 2021 17:59:01 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:59:01 GMT Message-Id: <202104081759.138Hx1c7022688@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: 489bde5753d2 - main - tcp_hostcache: hide rmx_hits/rmx_updates under ifdef. 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: 489bde5753d2ee591f9a36c9a9082903c8e24636 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:02 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=489bde5753d2ee591f9a36c9a9082903c8e24636 commit 489bde5753d2ee591f9a36c9a9082903c8e24636 Author: Gleb Smirnoff AuthorDate: 2021-03-22 20:35:25 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-08 17:58:44 +0000 tcp_hostcache: hide rmx_hits/rmx_updates under ifdef. They have little value unless you do some profiling investigations, but they are performance bottleneck. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 5c8a6570425f..e048f926b02b 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -130,8 +130,10 @@ struct hc_metrics { uint32_t rmx_recvpipe; /* inbound delay-bandwidth product */ /* TCP hostcache internal data */ int rmx_expire; /* lifetime for object */ +#ifdef TCP_HC_COUNTERS u_long rmx_hits; /* number of hits */ u_long rmx_updates; /* number of updates */ +#endif }; struct tcp_hostcache { @@ -513,7 +515,9 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) bzero(hc_metrics_lite, sizeof(*hc_metrics_lite)); return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_metrics_lite->rmx_mtu = hc_entry->rmx_mtu; @@ -548,7 +552,9 @@ tcp_hc_getmtu(struct in_conninfo *inc) if (hc_entry == NULL) { return 0; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ mtu = hc_entry->rmx_mtu; @@ -581,7 +587,9 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) if (hc_entry == NULL) return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_updates++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_entry->rmx_mtu = mtu; @@ -616,7 +624,9 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) if (hc_entry == NULL) return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_updates++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ if (hcml->rmx_rtt != 0) { @@ -712,7 +722,11 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) sbuf_printf(&sb, "\nIP address MTU SSTRESH RTT RTTVAR " - " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); + " CWND SENDPIPE RECVPIPE " +#ifdef TCP_HC_COUNTERS + "HITS UPD " +#endif + "EXP\n"); sbuf_drain(&sb); #define msec(u) (((u) + 500) / 1000) @@ -721,8 +735,11 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { sbuf_printf(&sb, - "%-15s %5u %8u %6lums %6lums %8u %8u %8u %4lu " - "%4lu %4i\n", + "%-15s %5u %8u %6lums %6lums %8u %8u %8u " +#ifdef TCP_HC_COUNTERS + "%4lu %4lu " +#endif + "%4i\n", hc_entry->ip4.s_addr ? inet_ntoa_r(hc_entry->ip4, ip4buf) : #ifdef INET6 @@ -739,8 +756,10 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_cwnd, hc_entry->rmx_sendpipe, hc_entry->rmx_recvpipe, +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits, hc_entry->rmx_updates, +#endif hc_entry->rmx_expire); } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx);