Date: Fri, 16 Apr 2021 22:11:59 GMT From: Richard Scheffenegger <rscheff@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a85003abdad4 - stable/11 - tcp: drain tcp_hostcache_list in between per-bucket locks Message-ID: <202104162211.13GMBx72087180@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/11 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=a85003abdad402c27c12cf1a31b243c39483f263 commit a85003abdad402c27c12cf1a31b243c39483f263 Author: Richard Scheffenegger <rscheff@FreeBSD.org> AuthorDate: 2021-03-31 17:24:01 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> CommitDate: 2021-04-16 21:33:20 +0000 tcp: drain tcp_hostcache_list in between per-bucket locks Explicitly drain the sbuf after completing each hash bucket to minimize the work performed while holding the hash bucket lock. PR: 254333 MFC after: 2 weeks Reviewed By: tuexen, jhb, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29483 (cherry picked from commit 869880463cc2ce64e2e6599eaec880a981f3ced6) --- sys/netinet/tcp_hostcache.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index e71f13243f0c..c4d51dd0bd59 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -642,12 +642,13 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) return(error); } - /* Use a buffer for 16 lines */ - sbuf_new_for_sysctl(&sb, NULL, 16 * linesize, req); + /* Use a buffer sized for one full bucket */ + sbuf_new_for_sysctl(&sb, NULL, V_tcp_hostcache.bucket_limit * linesize, req); sbuf_printf(&sb, "\nIP address MTU SSTRESH RTT RTTVAR " " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); + sbuf_drain(&sb); #define msec(u) (((u) + 500) / 1000) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { @@ -678,6 +679,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_expire); } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + sbuf_drain(&sb); } #undef msec error = sbuf_finish(&sb);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104162211.13GMBx72087180>