git: d59bc188d652 - main - sockbuf: remove unused mbuf counter and cluster counter
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 27 May 2022 15:20:54 UTC
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d59bc188d652dfaa06bef9963120aa54c4c68875 commit d59bc188d652dfaa06bef9963120aa54c4c68875 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2022-05-27 15:19:28 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> 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.