From owner-freebsd-net@FreeBSD.ORG Thu Sep 7 19:20:12 2006 Return-Path: X-Original-To: freebsd-net@freebsd.org Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 245DE16A4F3; Thu, 7 Sep 2006 19:20:12 +0000 (UTC) (envelope-from rrs@cisco.com) Received: from sj-iport-1.cisco.com (sj-iport-1-in.cisco.com [171.71.176.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5622543D46; Thu, 7 Sep 2006 19:20:11 +0000 (GMT) (envelope-from rrs@cisco.com) Received: from sj-dkim-8.cisco.com ([171.68.10.93]) by sj-iport-1.cisco.com with ESMTP; 07 Sep 2006 12:20:11 -0700 Received: from sj-core-4.cisco.com (sj-core-4.cisco.com [171.68.223.138]) by sj-dkim-8.cisco.com (8.12.11.20060308/8.12.11) with ESMTP id k87JKBWA009361; Thu, 7 Sep 2006 12:20:11 -0700 Received: from xbh-sjc-211.amer.cisco.com (xbh-sjc-211.cisco.com [171.70.151.144]) by sj-core-4.cisco.com (8.12.10/8.12.6) with ESMTP id k87JKA6W022249; Thu, 7 Sep 2006 12:20:11 -0700 (PDT) Received: from xfe-sjc-211.amer.cisco.com ([171.70.151.174]) by xbh-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 7 Sep 2006 12:20:09 -0700 Received: from [127.0.0.1] ([171.68.225.134]) by xfe-sjc-211.amer.cisco.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 7 Sep 2006 12:20:08 -0700 Message-ID: <450070CC.7070701@cisco.com> Date: Thu, 07 Sep 2006 15:19:40 -0400 From: Randall Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060223 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andre Oppermann References: <44F35A65.3080605@cisco.com> <20060828224452.GK37035@funkthat.com> <44F45A2A.8030405@freebsd.org> <20060902081043.J32527@mp2.macomnet.net> <44F9386A.30804@freebsd.org> In-Reply-To: <44F9386A.30804@freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 07 Sep 2006 19:20:08.0522 (UTC) FILETIME=[A1AE8AA0:01C6D2B2] DKIM-Signature: a=rsa-sha1; q=dns; l=2177; t=1157656811; x=1158520811; c=relaxed/relaxed; s=sjdkim8002; h=Content-Type:From:Subject:Content-Transfer-Encoding:MIME-Version; d=cisco.com; i=rrs@cisco.com; z=From:Randall=20Stewart=20 |Subject:Re=3A=20Problem=20with=20uipc_mbuf.c; X=v=3Dcisco.com=3B=20h=3DGX4otkzfuvQkPAK8JGkm7Q3VVZc=3D; b=Lv81Dz7Q6K6O+HtuRVXN0qCZf0u+XXwwhhF4mwDB5n4NZXa2h72Rb166ggVrLYS5dxeZZhuG 1zKKNgEANerCHDkmsZHLZdgoRScdqS7oNVGhRQzosW50/UcNtVlYkMF/; Authentication-Results: sj-dkim-8.cisco.com; header.From=rrs@cisco.com; dkim=pass ( sig from cisco.com verified; ); Cc: freebsd-net@freebsd.org Subject: Re: Problem with uipc_mbuf.c X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 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, 07 Sep 2006 19:20:12 -0000 Andre: Without the "fix" SCTP leaks mbufs when running netpipe.. for some reason my other tests (utilites) do not do so.. but I think it has to do with the back-and-forth nature of netpipe.. it sends and then receives constantly while most of the other things I play with have a source and a sink.. Anyway.. without the fix we leak clusters like crazy on a SMP machine.. maybe not like crazy.. but at least 1 cluster per every few megabytes transfered by netpipe.. I think the fix is really quite good.. it will only affect you if you have multiple CPU's operating on the mbuf (mfree()) at the same time.. The majority case takes the first part of the if.. R Andre Oppermann wrote: > Maxim Konovalov wrote: > >> On Tue, 29 Aug 2006, 17:15+0200, Andre Oppermann wrote: >> >>> John-Mark Gurney wrote: >>> >>>> Randall Stewart wrote this message on Mon, Aug 28, 2006 at 17:04 -0400: >>>> >>>>> atomic_fetchadd_int(m->m_ext.ref_cnt, -1) == 0) { >>>> >>>> ^ >>>> >>>> This should be 1 not 0.. as apparently fetchadd_int returns the >>>> old value (at least that's what atomic(9) says), which means that >>>> if we ever race on this comparision, we won't free though we >>>> should of... >>>> >>>> if we look at refcount.h, it does: >>>> return (atomic_fetchadd_int(count, -1) == 1); >>>> >>>> which release a reference and apparently returns true if it needs to >>>> be free'd... >>>> >>>> Though the wierd part is that andre, "fixed" it to be 0 in 1.157: >>>> Fix a logic error introduced with mandatory mbuf cluster >>>> refcounting and freeing of mbufs+clusters back to the packet zone. >>> >>> Honestly I'm a bit confused myself now and have to dig up things from >>> when I did the change. However I'm certain there was a problem and the >>> commit fixed it in some way (not necessarily the correct way). Before >>> the 'fix' there were some larger leaks going on. >> >> >> So what's the conclusion? Perhaps it's worth to add an XXX comment in >> meantime. > > > Please give me until Thursday to resolve this issue. > -- Randall Stewart NSSTG - Cisco Systems Inc. 803-345-0369 815-342-5222 (cell)