From owner-freebsd-net@freebsd.org Thu Nov 2 07:19:41 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 103DFE52252; Thu, 2 Nov 2017 07:19:41 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [78.47.246.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 82E99709F0; Thu, 2 Nov 2017 07:19:39 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.15.2/8.15.2) with ESMTPS id vA27JPvi000321 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 2 Nov 2017 08:19:26 +0100 (CET) (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: lev@FreeBSD.org Received: from eg.sd.rdtc.ru (eugen@localhost [127.0.0.1]) by eg.sd.rdtc.ru (8.15.2/8.15.2) with ESMTP id vA27JMQS040763; Thu, 2 Nov 2017 14:19:22 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Low default setting of UDBHASHSIZE leads to unresponsive system To: lev@FreeBSD.org, freebsd-net@freebsd.org, freebsd-stable@freebsd.org References: From: Eugene Grosbein Message-ID: <59FAC6FA.3070804@grosbein.net> Date: Thu, 2 Nov 2017 14:19:22 +0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: Yes, score=5.5 required=5.0 tests=BAYES_00, DATE_IN_FUTURE_96_Q, LOCAL_FROM,RDNS_NONE autolearn=no autolearn_force=no version=3.4.1 X-Spam-Report: * 3.3 DATE_IN_FUTURE_96_Q Date: is 4 days to 4 months after Received: date * -2.3 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 1.9 RDNS_NONE Delivered to internal network by a host with no rDNS * 2.6 LOCAL_FROM From my domains X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hz.grosbein.net X-Spam-Flag: YES X-Spam-Level: ***** X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2017 07:19:41 -0000 On 01.11.2017 22:35, Lev Serebryakov wrote: > > Now 11-STABLE (and 12-CURRENT too) have this: > > sys/netinet/udp_usrreq.c:#define UDBHASHSIZE 128 > > Looks like such low value could lead to 100% consumption of CPU by > interrupt threads (igb queues in my case) on heavy incoming UDP traffic > (torrents with uTP in my case). > > My system (E3-1220v3 with I210 NICs) becomes completely unresponsive > (nut complains about lost connection to UPS, ssh to system times out, > etc) when system downloads torrent with many uTP (UDP) peers. Four igb0 > queues consume 100% CPU each in this scenario. > > Total traffic could be very low like 500KiB/s (yes, 500KiB/s, not > MiB/s!), I don't speak about 1Gbit/s or even 100Mbit/s here! > > Rebuilding kernel with UDBHASHSIZE=16384 seems to help. > > Why is this value so low and why I need to patch sources to change it? > Many such settings are changeable via sysctl and/or tunables, but this > one looks hardcoded. You should fill a PR. Attach these performance numbers you got. If possible, attach a patch introducing new loader tunnable, that should be easy. Keep me CC'd.