From owner-freebsd-bugs@FreeBSD.ORG Thu Aug 12 19:20:57 2004 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BDB1B16A4CE; Thu, 12 Aug 2004 19:20:57 +0000 (GMT) Received: from shellma.zin.lublin.pl (shellma.zin.lublin.pl [212.182.126.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 515D043D45; Thu, 12 Aug 2004 19:20:57 +0000 (GMT) (envelope-from pawmal-posting@freebsd.lublin.pl) Received: by shellma.zin.lublin.pl (Postfix, from userid 1018) id 819763474C2; Thu, 12 Aug 2004 16:10:20 +0200 (CEST) Date: Thu, 12 Aug 2004 16:10:20 +0200 From: Pawel Malachowski To: freebsd-gnats-submit@FreeBSD.org, eugen@grosbein.pp.ru Message-ID: <20040812141020.GA28613@shellma.zin.lublin.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4.2i cc: freebsd-bugs@freebsd.org Subject: Re: kern/46557: ipfw pipe show fails with lots of queues X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Aug 2004 19:20:57 -0000 Hello, I've just hit this problem on my 4.10-STABLE dummynet shaper. Very bad, since `ipfw pipe show N' + net.inet.ip.dummynet.expire=0 is quite useful for grabbing some per-user statistics. :/ Here are more details what is going on. I hope someone will look at this and explain why malloc() can fail here and what can be done to prevent this. % ipfw pipe show ipfw: getsockopt(IP_DUMMYNET_GET): No buffer space available This command invokes getsockopt() trying to fetch all pipes data from kernel to userland. Kernel part of this is being done in dummynet_get(), which tries to allocate buf big (previously computed size) enough for all data: buf = malloc(size, M_TEMP, M_NOWAIT); if (buf == 0) { splx(s); return ENOBUFS ; } This malloc() call fails sometimes on loaded system (10k-70k of dynamic pipes + make buildworld;)) causing `ipfw pipe show' command failure. I've registered temporary MALLOC_DEFINE M_YOYO and changed this malloc/free from M_TEMP to M_YOYO, ;) so I can easily track this in `vmstat -m' output: 1. Quite early (no problems): Type InUse MemUse HighUse Limit Requests Limit Limit Size(s) IpFw/IpAcct 113 14K 14K 42107K 113 0 0 64,128,256 yoyo 0 0K 120K 42107K 1 0 0 128K dummynet 1612 311K 313K 42107K 139366 0 0 16,128,256,4K Memory Totals: In Use Free Requests 3921K 32K 173824 2. After some time malloc() in dummynet_get() fails and: Type InUse MemUse HighUse Limit Requests Limit Limit Size(s) IpFw/IpAcct 113 14K 14K 42107K 113 0 0 64,128,256 yoyo 0 0K 2828K 42107K 12913 0 0 128K,512K dummynet 21432 2790K 3354K 42107K 9804136 0 0 16,128,256,512,1K,4K Memory Totals: In Use Free Requests 9932K 3029K 14216860 In /sbin/ipfw2, list(): (do_cmd(ocmd, data, (uintptr_t)&nbytes) < 0) nbytes were 2188288 // In loop, I +1024 numbytes instead of *2+200, ignore this In ip_dummynet.c, dummynet_get(): buf = malloc(size, M_YOYO, M_NOWAIT); // note: M_TEMP => M_YOYO size was 2390416 and malloc() failed. -- Paweł Małachowski