From 3076c7c50d3d64d45241855459f1fc34cfebfddb Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Fri, 1 Oct 1999 14:21:50 +0000 Subject: [PATCH] Force the "calls" count for malloc types to be 64 bit where it keeps track of the number of times a particular type has been used. It's rather easy to overflow. One site I'm looking at seems to do it in a matter of days. On the Alpha this is a no-op since 'long' is 64 bit already. The sole user of this interface seems to be vmstat -m and friends which will need a recompile. The overheads of using a 64 bit int should be pretty light as the kernel just does "calls++" type operations and that's it. --- sys/sys/malloc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index b0bb1feeb8d..99eb85cbfe1 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -57,7 +57,7 @@ struct malloc_type { long ks_limit; /* most that are allowed to exist */ long ks_size; /* sizes of this thing that are allocated */ long ks_inuse; /* # of packets of this type currently in use */ - long ks_calls; /* total packets of this type ever allocated */ + int64_t ks_calls; /* total packets of this type ever allocated */ long ks_maxused; /* maximum number ever used */ u_long ks_magic; /* if it's not magic, don't touch it */ const char *ks_shortdesc; /* short description */ @@ -100,10 +100,10 @@ struct kmemusage { struct kmembuckets { caddr_t kb_next; /* list of free blocks */ caddr_t kb_last; /* last free block */ + int64_t kb_calls; /* total calls to allocate this size */ long kb_total; /* total number of blocks allocated */ long kb_elmpercl; /* # of elements in this sized allocation */ long kb_totalfree; /* # of free elements in this bucket */ - long kb_calls; /* total calls to allocate this size */ long kb_highwat; /* high water mark */ long kb_couldfree; /* over high water mark and could free */ };