Subject: Re: change in gathering of kernel memory stats
To: Michael Graff <firstname.lastname@example.org>
From: Dennis Ferguson <email@example.com>
Date: 02/02/1997 14:22:17
Michael Graff <firstname.lastname@example.org> writes:
> I haven't checked the source yet, but what happens if you compile the kernel
> without KMEMSTATS and then compile an LKM, say AFS, with it?
> I hope I'm wrong, and AFS won't need to have two versions, one for KMEMSTATS
> allocation and one for those without.
I think the rule of thumb for an lkm is don't use MALLOC() and FREE(), just
use malloc() and free().
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.