tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Extend "struct malloc_type" for extended KMEMSTATS?



On Wed, Mar 31, 2010 at 03:16:59PM +0000, Christos Zoulas wrote:
> In article <20100331.151226.59481996.he%uninett.no@localhost>,
> Havard Eidnes  <he%NetBSD.org@localhost> wrote:
> >Comments?
> 
> >From my reading of the code ku_indx ranges from MINBUCKET (5 or 4
> depending) on _LP64 to MINBUCKET + 15. I would #define MAXBUCKET
> to be 15 in sys/param.h use MAXBUCKET instead of 15 in the ?: code
> to find BUCKETINDX(), and then declare ks_active as u_short
> ks_active[MAXBUCKET + 1] (do we ever see more than 65K active
> allocations?); and change the code to ksp->ks_active[kup->ku_indx
> - MINBUCKET]{--,++}. This would save ~100 bytes per struct malloc_type.
> 
> Also perhaps add checks for underflow:
> #if DIAGNOSTIC
>       if (ksp->ks_active[kup->ku_indx - MINBUCKET] == 0)
>               panic("...");
> #endif
>       ksp->ks_active[kup->ku_indx - MINBUCKET]--;
> 
> and overflow when DIAGNOSTIC.

let's learn from the POSIX getline(3) fun we had, and use less generic
names than MINBUCKET and MAXBUCKET, please, especially if they're
going in <sys/param.h>?

thanks,
alistair


Home | Main Index | Thread Index | Old Index