From owner-freebsd-hackers Sun Apr 16 6:53: 1 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from happy.checkpoint.com (happy.checkpoint.com [199.203.156.41]) by hub.freebsd.org (Postfix) with ESMTP id A909D37B6BA for ; Sun, 16 Apr 2000 06:52:55 -0700 (PDT) (envelope-from mellon@pobox.com) Received: (from mellon@localhost) by happy.checkpoint.com (8.9.3/8.9.3) id QAA31303; Sun, 16 Apr 2000 16:52:23 GMT (envelope-from mellon@pobox.com) Date: Sun, 16 Apr 2000 16:52:23 +0000 From: Anatoly Vorobey To: Poul-Henning Kamp Cc: hackers@freebsd.org Subject: Re: memory in the kernel Message-ID: <20000416165223.A31100@happy.checkpoint.com> References: <20000416123037.A24869@happy.checkpoint.com> <4887.955892191@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <4887.955892191@critter.freebsd.dk>; from phk@critter.freebsd.dk on Sun, Apr 16, 2000 at 03:36:31PM +0200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sun, Apr 16, 2000 at 03:36:31PM +0200, Poul-Henning Kamp wrote: > In message <20000416123037.A24869@happy.checkpoint.com>, Anatoly Vorobey writes > : > >I have to malloc a lot of memory in the kernel, hence a few > >questions: > > How much is "a lot" ? Apparently somewhere in the vicinity of 8Mb, and also coming in a form of many hash tables, dynamic-size linked lists, variable-length structs, etc. so it's not practical to estimate a high bound, allocate and be done with it. FWIW, I think Win32 got it right in providing growable private heaps, where you can create your own heap and malloc() from it, and then just return all the memory back with one destroy call. It makes a lot of sense in some contexts. > >1. The data must be absolutely present at all times, no page > >faults or locking mechanisms, etc. Does that mean > >I should use kmem_alloc_wired() or am I misunderstanding its purpose? > >Does it make sense to alloc less than a pageful or is the rest simply > >going to be wasted? > > malloc(9) should be used. Thanks! -- Anatoly Vorobey, mellon@pobox.com http://pobox.com/~mellon/ "Angels can fly because they take themselves lightly" - G.K.Chesterton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message