From nobody Fri May 27 15:20:54 2022 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 C145C1B4267F; Fri, 27 May 2022 15:20:54 +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 4L8pRB57Hyz3kkq; Fri, 27 May 2022 15:20:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653664854; 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=XVLeWdAkrQLSf/HvYeDmPczKVYqP95Pl75nKoKKREpo=; b=VnmaCpx6boDK7qTYVOvgrftZI3Kc2yTAfVfCzWd2oUIU8H1aKxcAaYMJ2KvSYbUO939Wkt 5OKfgdIcKa6vpyjBVth4xaPeOS01RYFERS+AnborhnB2oPNaNjq4NefOQMFJX3DQ0v58fj f4kj8fHQuoLXe9wMggmpedZIyYuDR8zQOhW+9GvtYL93ctZfHDrFd2yD+ynxsvnSJRunSO HqF8F404maoi2ims1/I7jqRrx3UVGq/+16FuHN7hhhAq5W3orWjnlfZserNo05niJ1TOk2 JNMEXpYJyzCRAwkFy7qx/nkq39ysax6pPvfcG2XUtDmxaxBdrGa6CikPFecOwg== 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 8424A242ED; Fri, 27 May 2022 15:20:54 +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 24RFKsLo011730; Fri, 27 May 2022 15:20:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 24RFKsQO011729; Fri, 27 May 2022 15:20:54 GMT (envelope-from git) Date: Fri, 27 May 2022 15:20:54 GMT Message-Id: <202205271520.24RFKsQO011729@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: d59bc188d652 - main - sockbuf: remove unused mbuf counter and cluster counter 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: d59bc188d652dfaa06bef9963120aa54c4c68875 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1653664854; 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=XVLeWdAkrQLSf/HvYeDmPczKVYqP95Pl75nKoKKREpo=; b=T9gN9aC+v9e2N8cVxPv3/sdnZ2ccNL6WjBSwaEmbrBHrF/MBYrFQFvRAmGqSYPMmRryQQ9 qvgPQaS+UJXXt+FnU0M5L2eyNys60V1bym5NAyc18qjLCilZtroYi6GoEVR4Dx2cTbGx1C 4pUlW1+iduUgYOrGfU90rE14PnR8V3j6Rq2aMwI27Rzq1PbySFcU6oAxUpAVsN0ZWDGxK8 4wGVO5qdxB34QeVF5cnk9FC/a6M06J6Qm1+U7RkSBuZp3ETaJ6qdLEKcruJZIMbz1bINB1 5sr4/PEh5lmPdelQKGMKgMuBBJeWXRIPi7ejmi/7y16P/degci4rPclkycalzQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1653664854; a=rsa-sha256; cv=none; b=pLmRLvhcpxrPZBX1VHC7XE9YJpwKGaxyZrolvj89ipzINbUfEPUQGrgjV88A8ahfb1ub4n nBAK3/7XTKs6UEzxsU+1sRVP7Qapg2v2xswQ6jpsLhCvLx4M3yaY6/2LgX+0OH4uogm2cN is7g4GqJEaWwX8xjKXEpta4WyHdociXifChQFGyw9P3VRP2tE7qBX4zC9jxsPW1h3r6N4a WQL3Up5u6aP44sfQ3PATVwJ2oaULvXH97nfzDyAPZgIpdOAJJUCMycrToMQjpAOWx4aVuU YovxvkTUYmGSVu+RrwN1+bmaS4MCGbGkzE0VkoWkP1Zn7hBONrJxpIKpQpb48w== 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=d59bc188d652dfaa06bef9963120aa54c4c68875 commit d59bc188d652dfaa06bef9963120aa54c4c68875 Author: Gleb Smirnoff AuthorDate: 2022-05-27 15:19:28 +0000 Commit: Gleb Smirnoff CommitDate: 2022-05-27 15:20:17 +0000 sockbuf: remove unused mbuf counter and cluster counter With M_EXTPG mbufs these two counters already do not represent the reality. As we are moving towards protocol independent socket buffers, which may not even use mbufs at all, the counters become less and less relevant. The only userland seeing them was 'netstat -x'. PR: 264181 (exp-run) Reviewed by: markj Differential revision: https://reviews.freebsd.org/D35334 --- sys/kern/uipc_debug.c | 2 -- sys/kern/uipc_sockbuf.c | 31 ++++++------------------------- sys/sys/sockbuf.h | 2 -- sys/sys/socketvar.h | 2 -- usr.bin/netstat/inet.c | 13 +++---------- usr.bin/netstat/netstat.1 | 9 ++------- 6 files changed, 11 insertions(+), 48 deletions(-) diff --git a/sys/kern/uipc_debug.c b/sys/kern/uipc_debug.c index 2f60bb64ed3b..cbc26489d8fa 100644 --- a/sys/kern/uipc_debug.c +++ b/sys/kern/uipc_debug.c @@ -408,8 +408,6 @@ db_print_sockbuf(struct sockbuf *sb, const char *sockbufname, int indent) db_printf("sb_mbmax: %u\n", sb->sb_mbmax); db_print_indent(indent); - db_printf("sb_mcnt: %u ", sb->sb_mcnt); - db_printf("sb_ccnt: %u ", sb->sb_ccnt); db_printf("sb_ctl: %u ", sb->sb_ctl); db_printf("sb_lowat: %d ", sb->sb_lowat); db_printf("sb_timeo: %jd\n", sb->sb_timeo); diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index bc0a48a37810..07c21d3b7802 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -153,10 +153,8 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end) if ((m->m_flags & M_EXTPG) && m->m_len <= MLEN && !mbuf_has_tls_session(m)) { ext_size = m->m_ext.ext_size; - if (mb_unmapped_compress(m) == 0) { + if (mb_unmapped_compress(m) == 0) sb->sb_mbcnt -= ext_size; - sb->sb_ccnt -= 1; - } } while ((n != NULL) && (n != end) && (m->m_flags & M_EOR) == 0 && @@ -178,11 +176,8 @@ sbready_compress(struct sockbuf *sb, struct mbuf *m0, struct mbuf *end) sb->sb_mbtail = m; sb->sb_mbcnt -= MSIZE; - sb->sb_mcnt -= 1; - if (n->m_flags & M_EXT) { + if (n->m_flags & M_EXT) sb->sb_mbcnt -= n->m_ext.ext_size; - sb->sb_ccnt -= 1; - } m_free(n); n = m->m_next; } @@ -281,12 +276,9 @@ sballoc(struct sockbuf *sb, struct mbuf *m) sb->sb_ctl += m->m_len; sb->sb_mbcnt += MSIZE; - sb->sb_mcnt += 1; - if (m->m_flags & M_EXT) { + if (m->m_flags & M_EXT) sb->sb_mbcnt += m->m_ext.ext_size; - sb->sb_ccnt += 1; - } } /* @@ -324,11 +316,8 @@ sbfree(struct sockbuf *sb, struct mbuf *m) sb->sb_ctl -= m->m_len; sb->sb_mbcnt -= MSIZE; - sb->sb_mcnt -= 1; - if (m->m_flags & M_EXT) { + if (m->m_flags & M_EXT) sb->sb_mbcnt -= m->m_ext.ext_size; - sb->sb_ccnt -= 1; - } if (sb->sb_sndptr == m) { sb->sb_sndptr = NULL; @@ -354,12 +343,9 @@ sballoc_ktls_rx(struct sockbuf *sb, struct mbuf *m) sb->sb_tlscc += m->m_len; sb->sb_mbcnt += MSIZE; - sb->sb_mcnt += 1; - if (m->m_flags & M_EXT) { + if (m->m_flags & M_EXT) sb->sb_mbcnt += m->m_ext.ext_size; - sb->sb_ccnt += 1; - } } void @@ -374,12 +360,9 @@ sbfree_ktls_rx(struct sockbuf *sb, struct mbuf *m) sb->sb_tlscc -= m->m_len; sb->sb_mbcnt -= MSIZE; - sb->sb_mcnt -= 1; - if (m->m_flags & M_EXT) { + if (m->m_flags & M_EXT) sb->sb_mbcnt -= m->m_ext.ext_size; - sb->sb_ccnt -= 1; - } } #endif @@ -1812,8 +1795,6 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb) xsb->sb_cc = sb->sb_ccc; xsb->sb_hiwat = sb->sb_hiwat; xsb->sb_mbcnt = sb->sb_mbcnt; - xsb->sb_mcnt = sb->sb_mcnt; - xsb->sb_ccnt = sb->sb_ccnt; xsb->sb_mbmax = sb->sb_mbmax; xsb->sb_lowat = sb->sb_lowat; xsb->sb_flags = sb->sb_flags; diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index 753ebd1fbf35..a108e19b3ff3 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -95,8 +95,6 @@ struct sockbuf { u_int sb_ccc; /* (a) claimed chars in buffer */ u_int sb_hiwat; /* (a) max actual char count */ u_int sb_mbcnt; /* (a) chars of mbufs used */ - u_int sb_mcnt; /* (a) number of mbufs in buffer */ - u_int sb_ccnt; /* (a) number of clusters in buffer */ u_int sb_mbmax; /* (a) max chars of mbufs to use */ u_int sb_ctl; /* (a) non-data chars in buffer */ u_int sb_tlscc; /* (a) TLS chain characters */ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 05eefd7e4fd4..52b9376f0559 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -577,8 +577,6 @@ struct xsocket { uint32_t sb_cc; uint32_t sb_hiwat; uint32_t sb_mbcnt; - uint32_t sb_mcnt; - uint32_t sb_ccnt; uint32_t sb_mbmax; int32_t sb_lowat; int32_t sb_timeo; diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index 7cfffc9fa06c..b7dbcb3531b0 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -147,8 +147,6 @@ sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb) xsb->sb_cc = sb->sb_ccc; xsb->sb_hiwat = sb->sb_hiwat; xsb->sb_mbcnt = sb->sb_mbcnt; - xsb->sb_mcnt = sb->sb_mcnt; - xsb->sb_ccnt = sb->sb_ccnt; xsb->sb_mbmax = sb->sb_mbmax; xsb->sb_lowat = sb->sb_lowat; xsb->sb_flags = sb->sb_flags; @@ -351,11 +349,9 @@ protopr(u_long off, const char *name, int af1, int proto) xo_emit(" {T:/%-11.11s}", "(state)"); } if (xflag) { - xo_emit(" {T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " - "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " + xo_emit("{T:/%-6.6s} {T:/%-6.6s} " "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s} " "{T:/%-6.6s} {T:/%-6.6s} {T:/%-6.6s}", - "R-MBUF", "S-MBUF", "R-CLUS", "S-CLUS", "R-HIWA", "S-HIWA", "R-LOWA", "S-LOWA", "R-BCNT", "S-BCNT", "R-BMAX", "S-BMAX"); xo_emit(" {T:/%7.7s} {T:/%7.7s} {T:/%7.7s} " @@ -500,15 +496,12 @@ protopr(u_long off, const char *name, int af1, int proto) #endif /* INET6 */ } if (xflag) { - xo_emit("{:receive-mbufs/%6u} {:send-mbufs/%6u} " - "{:receive-clusters/%6u} {:send-clusters/%6u} " - "{:receive-high-water/%6u} {:send-high-water/%6u} " + xo_emit("{:receive-high-water/%6u} " + "{:send-high-water/%6u} " "{:receive-low-water/%6u} {:send-low-water/%6u} " "{:receive-mbuf-bytes/%6u} {:send-mbuf-bytes/%6u} " "{:receive-mbuf-bytes-max/%6u} " "{:send-mbuf-bytes-max/%6u}", - so->so_rcv.sb_mcnt, so->so_snd.sb_mcnt, - so->so_rcv.sb_ccnt, so->so_snd.sb_ccnt, so->so_rcv.sb_hiwat, so->so_snd.sb_hiwat, so->so_rcv.sb_lowat, so->so_snd.sb_lowat, so->so_rcv.sb_mbcnt, so->so_snd.sb_mbcnt, diff --git a/usr.bin/netstat/netstat.1 b/usr.bin/netstat/netstat.1 index e4186b9c9999..0907b5bc7a9f 100644 --- a/usr.bin/netstat/netstat.1 +++ b/usr.bin/netstat/netstat.1 @@ -28,7 +28,7 @@ .\" @(#)netstat.1 8.8 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd September 25, 2020 +.Dd May 27, 2022 .Dt NETSTAT 1 .Os .Sh NAME @@ -216,12 +216,7 @@ flag causes to output all the information recorded about data stored in the socket buffers. The fields are: -.Bl -column ".Li R-MBUF" -.It Li R-MBUF Ta Number of mbufs in the receive queue. -.It Li S-MBUF Ta Number of mbufs in the send queue. -.It Li R-CLUS Ta Number of clusters, of any type, in the receive -queue. -.It Li S-CLUS Ta Number of clusters, of any type, in the send queue. +.Bl -column ".Li R-HIWA" .It Li R-HIWA Ta Receive buffer high water mark, in bytes. .It Li S-HIWA Ta Send buffer high water mark, in bytes. .It Li R-LOWA Ta Receive buffer low water mark, in bytes.