Date: Wed, 05 Feb 2003 12:15:34 -0800 From: Peter Wemm <peter@wemm.org> To: Julian Elischer <julian@elischer.org> Cc: Jeff Roberson <jroberson@chesapeake.net>, Dag-Erling Smorgrav <des@ofug.org>, arch@FreeBSD.ORG Subject: Re: New kernel allocation API Message-ID: <20030205201534.4409C2A89E@canning.wemm.org> In-Reply-To: <Pine.BSF.4.21.0302051042480.97117-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer wrote: > > > On Wed, 5 Feb 2003, Jeff Roberson wrote: > > > On Tue, 4 Feb 2003, Peter Wemm wrote: > > > > > Dag-Erling Smorgrav wrote: > > > > --=-=-= > > > > > > > > The attached patch creates two new entry points for malloc(), named > > > > kalloc() and kalloc_nowait(), eliminating the need for the M_NOWAIT > > > > and M_TRYWAIT constants. The patch also defines malloc() as a macro > > > > which invokes the appropriate API function, so source-level > > > > compatibility is maintained. > > > > > > The current bikeshed is about the mbuf functions as well, not just the > > > malloc function.. > > > > > > > If you would like to make a new malloc/free api I have some comments. > > most notably, free should require the size on return. This yields much > > cleaner implementations with little or no cost to most consumers. I had > > some local patches to do this when I was working on uma but not having > > naturally aligned sizes broke too much code. > > I know several consumers where the size is not known or would be > expensive to calculate on free. When I've had to do this in the (distant) past, I've stored the variable size information inside the fixed portion of the structure that was being allocated.. In other situations situations, I used a second size field next to where I stored the pointer. This wasn't a great burden. Nostalgia note: Anybody remember AllocMem() and FreeMem()? Cheers, -Peter -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030205201534.4409C2A89E>