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. OK'ed by: rwatson MFC after: 2 days
This commit is contained in:
parent
8ecb9be842
commit
9c0918e899
@ -213,8 +213,10 @@ malloc_type_zone_allocated(struct malloc_type *mtp, unsigned long size,
|
||||
critical_enter();
|
||||
mtip = mtp->ks_handle;
|
||||
mtsp = &mtip->mti_stats[curcpu];
|
||||
mtsp->mts_memalloced += size;
|
||||
mtsp->mts_numallocs++;
|
||||
if (size > 0) {
|
||||
mtsp->mts_memalloced += size;
|
||||
mtsp->mts_numallocs++;
|
||||
}
|
||||
if (zindx != -1)
|
||||
mtsp->mts_size |= 1 << zindx;
|
||||
critical_exit();
|
||||
@ -224,7 +226,8 @@ void
|
||||
malloc_type_allocated(struct malloc_type *mtp, unsigned long size)
|
||||
{
|
||||
|
||||
malloc_type_zone_allocated(mtp, size, -1);
|
||||
if (size > 0)
|
||||
malloc_type_zone_allocated(mtp, size, -1);
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user