Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jul 2002 13:36:23 -0700 (PDT)
From:      Julian Elischer <julian@elischer.org>
To:        Jeff Roberson <jroberson@chesapeake.net>
Cc:        FreeBSD current users <current@FreeBSD.ORG>
Subject:   another UMA question.
Message-ID:  <Pine.BSF.4.21.0207041307500.6975-100000@InterJet.elischer.org>
In-Reply-To: <20020702195551.U91055-100000@mail.chesapeake.net>

next in thread | previous in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0207041307500.6975-100000>