The branch main has been updated by rscheff:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=869880463cc2ce64e2e6599eaec880a981f3ced6

commit 869880463cc2ce64e2e6599eaec880a981f3ced6
Author:     Richard Scheffenegger <[email protected]>
AuthorDate: 2021-03-31 17:24:01 +0000
Commit:     Richard Scheffenegger <[email protected]>
CommitDate: 2021-03-31 17:24:21 +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
---
 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 5fe905d9abf5..b6d0c0410df9 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -649,12 +649,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++) {
@@ -685,6 +686,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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to