fix overflow on huge NUMA boxes

This commit is contained in:
albert
2005-01-05 21:46:22 +00:00
parent 0edb6a86fb
commit 1010c1d281
4 changed files with 43 additions and 54 deletions

View File

@@ -136,8 +136,7 @@ static int parse_slabinfo20(struct slab_info **list, struct slab_stat *stats,
if (curr->obj_size > stats->max_obj_size)
stats->max_obj_size = curr->obj_size;
curr->cache_size = curr->nr_slabs * curr->pages_per_slab *
page_size;
curr->cache_size = (unsigned long)curr->nr_slabs * curr->pages_per_slab * page_size;
if (curr->nr_objs) {
curr->use = 100 * curr->nr_active_objs / curr->nr_objs;
@@ -147,8 +146,8 @@ static int parse_slabinfo20(struct slab_info **list, struct slab_stat *stats,
stats->nr_objs += curr->nr_objs;
stats->nr_active_objs += curr->nr_active_objs;
stats->total_size += curr->nr_objs * curr->obj_size;
stats->active_size += curr->nr_active_objs * curr->obj_size;
stats->total_size += (unsigned long)curr->nr_objs * curr->obj_size;
stats->active_size += (unsigned long)curr->nr_active_objs * curr->obj_size;
stats->nr_pages += curr->nr_slabs * curr->pages_per_slab;
stats->nr_slabs += curr->nr_slabs;
stats->nr_active_slabs += curr->nr_active_slabs;
@@ -215,8 +214,7 @@ static int parse_slabinfo11(struct slab_info **list, struct slab_stat *stats,
if (curr->obj_size > stats->max_obj_size)
stats->max_obj_size = curr->obj_size;
curr->cache_size = curr->nr_slabs * curr->pages_per_slab *
page_size;
curr->cache_size = (unsigned long)curr->nr_slabs * curr->pages_per_slab * page_size;
if (curr->nr_objs) {
curr->use = 100 * curr->nr_active_objs / curr->nr_objs;
@@ -230,8 +228,8 @@ static int parse_slabinfo11(struct slab_info **list, struct slab_stat *stats,
stats->nr_objs += curr->nr_objs;
stats->nr_active_objs += curr->nr_active_objs;
stats->total_size += curr->nr_objs * curr->obj_size;
stats->active_size += curr->nr_active_objs * curr->obj_size;
stats->total_size += (unsigned long)curr->nr_objs * curr->obj_size;
stats->active_size += (unsigned long)curr->nr_active_objs * curr->obj_size;
stats->nr_pages += curr->nr_slabs * curr->pages_per_slab;
stats->nr_slabs += curr->nr_slabs;
stats->nr_active_slabs += curr->nr_active_slabs;

View File

@@ -1,35 +1,35 @@
#ifndef _PROC_SLAB_H
#define _PROC_SLAB_H
#define SLAB_INFO_NAME_LEN 64
#define SLAB_INFO_NAME_LEN 64
struct slab_info {
char name[SLAB_INFO_NAME_LEN]; /* name of this cache */
char name[SLAB_INFO_NAME_LEN]; /* name of this cache */
struct slab_info *next;
int nr_objs; /* number of objects in this cache */
int nr_active_objs; /* number of active objects */
int obj_size; /* size of each object */
int objs_per_slab; /* number of objects per slab */
int pages_per_slab; /* number of pages per slab */
int nr_slabs; /* number of slabs in this cache */
int nr_active_slabs; /* number of active slabs */
int use; /* percent full: total / active */
int cache_size; /* size of entire cache */
unsigned long cache_size; /* size of entire cache */
unsigned nr_objs; /* number of objects in this cache */
unsigned nr_active_objs; /* number of active objects */
unsigned obj_size; /* size of each object */
unsigned objs_per_slab; /* number of objects per slab */
unsigned pages_per_slab; /* number of pages per slab */
unsigned nr_slabs; /* number of slabs in this cache */
unsigned nr_active_slabs; /* number of active slabs */
unsigned use; /* percent full: total / active */
};
struct slab_stat {
int nr_objs; /* number of objects, among all caches */
int nr_active_objs; /* number of active objects, among all caches */
int total_size; /* size of all objects */
int active_size; /* size of all active objects */
int nr_pages; /* number of pages consumed by all objects */
int nr_slabs; /* number of slabs, among all caches */
int nr_active_slabs; /* number of active slabs, among all caches */
int nr_caches; /* number of caches */
int nr_active_caches; /* number of active caches */
int avg_obj_size; /* average object size */
int min_obj_size; /* size of smallest object */
int max_obj_size; /* size of largest object */
unsigned long total_size; /* size of all objects */
unsigned long active_size; /* size of all active objects */
unsigned nr_objs; /* number of objects, among all caches */
unsigned nr_active_objs; /* number of active objects, among all caches */
unsigned nr_pages; /* number of pages consumed by all objects */
unsigned nr_slabs; /* number of slabs, among all caches */
unsigned nr_active_slabs; /* number of active slabs, among all caches */
unsigned nr_caches; /* number of caches */
unsigned nr_active_caches; /* number of active caches */
unsigned avg_obj_size; /* average object size */
unsigned min_obj_size; /* size of smallest object */
unsigned max_obj_size; /* size of largest object */
};
extern void put_slabinfo(struct slab_info *);