From owner-freebsd-current Thu Jul 4 13:40:20 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2B1FF37B400 for ; Thu, 4 Jul 2002 13:40:12 -0700 (PDT) Received: from sccrmhc03.attbi.com (sccrmhc03.attbi.com [204.127.202.63]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9017A43E09 for ; Thu, 4 Jul 2002 13:40:11 -0700 (PDT) (envelope-from julian@elischer.org) Received: from InterJet.elischer.org ([12.232.206.8]) by sccrmhc03.attbi.com (InterMail vM.4.01.03.27 201-229-121-127-20010626) with ESMTP id <20020704204010.YZCE903.sccrmhc03.attbi.com@InterJet.elischer.org>; Thu, 4 Jul 2002 20:40:10 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id NAA09705; Thu, 4 Jul 2002 13:36:24 -0700 (PDT) Date: Thu, 4 Jul 2002 13:36:23 -0700 (PDT) From: Julian Elischer To: Jeff Roberson Cc: FreeBSD current users Subject: another UMA question. In-Reply-To: <20020702195551.U91055-100000@mail.chesapeake.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG SO I'm using UMA to store threads however UMA seem sto be too eager to create new threads.. for example: (my own version has more instrumentation) ref4# sysctl kern.threads kern.threads.active: 71 <- number currently attached to processes kern.threads.cached: 76 <- number in the UMA pool kern.threads.allocated: 147 <- number presently allocated + cached kern.threads.freed: 0 <- number of times fini() called kern.threads.total: 147 <- number of times init() called kern.threads.max: 79 <- highest ever value of 'active' given that the threads each have an 8k stack attached, this means that there are 68 x 8k stacks that will never be used.. (557056 bytes of wasted ram) how would I go about 'tuning' this? also: After a while UMA starts freeing and then reallocating these: e.g. ref4# sysctl kern.threads kern.threads.active: 63 kern.threads.cached: 147 kern.threads.allocated: 210 kern.threads.freed: 231 kern.threads.total: 441 kern.threads.max: 84 this is wasteful to allocate and deallocate (with all the work involved) 231 threads and sacks for no reason (after it freed them, it pretty quickly reallocated them as you see, there are 147 presently cached, representing 1.2Mb of ram. Can the algorythms be tuned to use a more gentle hysteresis? Can the high and low watermarks be specified per type? Is there a chance you can add a uma_zadjust() or something that allows us to set the cache high and low water marks etc? For example I really don;t want it to start allocating new threads until I have maybe only 12 or so left in the cache. On the other hand I probably want to free them from the cache if I have more than say 40.. This is why I originally used my own cache.. Eventually I would like to be able to adjust the zone parameters according to recent history.. I would like to calculate a running average and variance of thread usage and aim to keep the caches adjusted for AVERAGE + 3xStandard deviations or something. This suggests that I should be able to register another management method with UMA for that zone... thoughts? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message