From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 22 07:41:22 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 656EE16A469 for ; Thu, 22 Nov 2007 07:41:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4F18113C4E5 for ; Thu, 22 Nov 2007 07:41:22 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [209.31.154.41]) by cyrus.watson.org (Postfix) with ESMTP id 89B2246E81; Wed, 21 Nov 2007 16:35:12 -0500 (EST) Date: Wed, 21 Nov 2007 21:32:16 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Juri Mianovich In-Reply-To: <748599.27133.qm@web45609.mail.sp1.yahoo.com> Message-ID: <20071121212431.N60495@fledge.watson.org> References: <748599.27133.qm@web45609.mail.sp1.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: peak mbuf stat missing ... and needed ... X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Nov 2007 07:41:22 -0000 On Mon, 19 Nov 2007, Juri Mianovich wrote: > I am sorry to repost, but I cannot get any answer on this from -net or > -questions ... is there any answer to getting this stat ? (see below) Juri, I recognize the importance of your point, and can shed a little light on why things are the way they are. In FreeBSD 5, Bosko Milekic introduced MBUMA, a UMA-backed caching slab allocator for mbufs and related data structures implemented using extensions to UMA(9). One of the properties of UMA is that it's possible to allocate packet storage from CPU-local caches rather than going to a central pool protected by central locks. Almost all allocations occur this way in practice, and only intermittently return to the centra allocator to eithe flush many freed packets back to the central cache, or pull more out; this occurs when there is an imbalance in allocation and freeing across CPUs, such as when a pipeline occurs in packet processing over a series of CPUs. As a result, there is in fact no central tracking of how many mbufs are currently allocated -- the central zone knows about the number currently not present in the zone, but that just means they are in either a per-CPU cache or in use, not that they are actually allocated. The notion of peak allocation is obviously a very important one for precisely the reasons you identify. The question is how best to provide it without seriously impacting performance *or* providing one that is potentially quite inaccurate. The "current" measure is based on taking a non-atomic snapshot of the global allocation stats and per-CPU stats, which means potentially it can be very slightly inconsistent. We don't want to update the peak stat on every allocation, I think, as it would be a global measure, and involve dirtying global cache lines and so on. Perhaps we could be maintaining that peak value whenever CPUs go back to the global pool from a per-CPU cache, since the right locks will be held anyway... I don't see this being fixed for 6.3 or 7.0 given their proximity, but I will investigate a fix for later releases. Could you file a feature request PR on this, and forward me the PR receipt so I can take ownership of it? Thanks, Robert N M Watson Computer Laboratory University of Cambridge > > ----- > > FreeBSD 4.x, netstat -m: > > 70/4336/26624 mbufs in use (current/peak/max) > > Never any doubt - if peak=max, I hit the limit. Super > useful. Furthermore, by watching the peak I can see > when I am getting close, rather than waiting for > denied requests to pile up after the fact. > > FreeBSD 6.x, netstat -m: > > 524/826/1350 mbufs in use (current/cache/total) > > So ... how do I see peak mbufs in FreeBSD 6.x ? > > Thanks. > > > > ____________________________________________________________________________________ > Get easy, one-click access to your favorites. > Make Yahoo! your homepage. > http://www.yahoo.com/r/hs > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >