Subject: Re: change in gathering of kernel memory stats
To: Dennis Ferguson <>
From: Jason Thorpe <>
List: current-users
Date: 02/02/1997 14:25:59
On Sun, 02 Feb 1997 14:22:17 -0800 
 Dennis Ferguson <> wrote:

 > The use of free() is not a hardship at all, actually, since if you measure
 > it you'll find the savings from using FREE() are miniscule (it isn't called
 > that often in any case, and the overhead of a function call just isn't
 > that large compared to the work it does).  MALLOC() does save you a worth
 > while amount of work in the particular case that the size of the structure
 > you are allocating is a compile-time constant, but probably isn't used enough
 > to make the use of malloc() too disadvantageous for an lkm.

The one place where this can bite you is with LKMs that do any sort
of mbuf allocation... MGET() contains a call to MALLOC().

Perhaps a global (maybe "do_kmemstats"?) would be good, so that a fairly
cheap runtime test can be made inside the MALLOC() and FREE() macros.

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939