cvs commit: src/sys/kern kern_malloc.c

Robert Watson rwatson at FreeBSD.org
Wed Jul 27 23:33:33 GMT 2005


On Wed, 27 Jul 2005, Pawel Jakub Dawidek wrote:

>  Fix the way how "InUse" column in 'vmstat -m' output works:
>  - increase number of allocations count only on successfull malloc(9),
>    so it doesn't confuse people;
>  - because we need to check if 'size > 0', hide 'mtsp->mts_memalloced += size;'
>    under the check as well, as for size=0 it is of course a no-op;
>  - avoid critical_enter()/critical_exit() in case of failure in
>    malloc_type_allocated() as there will be nothing to do.

I think it would be quite useful to track malloc failures by type, not 
just successes; libmemstat(3) incudes a memstat_get_failures() call to 
retrieve failure statistics if they are supported by the underlying 
allocator.  Adding a per-cpu failure account should be straight forward; 
also, I wouldn't worry to much about the cost of the critical enter/exit 
in the failure case, as optimizing for failures in malloc(9) will have 
little impact on system performance (especially since the removal of 
administrative limits on malloc types).

Robert N M Watson


More information about the cvs-src mailing list