From owner-freebsd-current Mon Jul 1 10:59:21 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 37DB237B400 for ; Mon, 1 Jul 2002 10:59:17 -0700 (PDT) Received: from mail.chesapeake.net (chesapeake.net [205.130.220.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D95543E0A for ; Mon, 1 Jul 2002 10:59:16 -0700 (PDT) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost) by mail.chesapeake.net (8.11.6/8.11.6) with ESMTP id g61HxEe36420; Mon, 1 Jul 2002 13:59:14 -0400 (EDT) (envelope-from jroberson@chesapeake.net) Date: Mon, 1 Jul 2002 13:59:14 -0400 (EDT) From: Jeff Roberson To: julian@elischer.org Cc: current@freebsd.org Subject: Re: FW: UMA question.. In-Reply-To: Message-ID: <20020701135029.A91055-100000@mail.chesapeake.net> 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 > > Jeff , (current included because it may be an interesting answer) > > > As you know I'm using UMA to allocate threads and cache them. > The 'constructor methods allow me to allocated threads that have been > pre-set up with thread stacks and other special items. > > > When they are being cached they still have their stacks etc. attached to > them. These are only splitt off when the UMA decides to stop caching an > item and actualy return it's memory to the system. > In this regard the UMA allocator is not a memory alocator but a 'complex > object allocator'... Very cool. > > Now my question.. > > I ant to allocate proc structures the same way... > in other words, I want a cached proc structure to already have a thread > attached to it and a stack attached to the thread.. > Is it legal for teh init function which is called by UMA to in turn > call UMA to allocate a sub element.. > > so if I do uma_zalloc(proc args) > that in turn should do a uma_zalloc(thread args). > would this work? is it legal? No locks are held when doing init ctor or fini. The zone and possibly per cpu queue lock is held while doing the dtor though. So it is safe as long as you don't cause a recursive allocation in the same zone. In short, what you want to do is perfectly reasonable. > > I need to allocate extra threads independantly of processes, but I could > work it so that freed process structures always had a single thread left > on them, which would save on allocations.. > In the future I need to do teh same for KSEs and KSEGRPS. sp having > UMA cache pre-constructed complex items made up of groups of separatly > UMA-allocated objects would be a great saving.. > > the question is.. will it work? can I call UMA from withing a UMA > constructor? > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message