bprocps: fix order of operations for %use of slabinfo
In some environments, 100 * nr_active_objs is calculated at first, and lower 32bit of the result is divided by nr_objs. If 100 * nr_active_objs > 42949672, %use will be incorrect. Signed-off-by: Takayuki Nagata <tnagata@redhat.com>
This commit is contained in:
parent
a0f0f4fc69
commit
99d71ad581
@ -179,7 +179,7 @@ static int parse_slabinfo20(struct slab_info **list, struct slab_stat *stats,
|
|||||||
curr->cache_size = (unsigned long)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) {
|
if (curr->nr_objs) {
|
||||||
curr->use = 100 * curr->nr_active_objs / curr->nr_objs;
|
curr->use = 100 * (curr->nr_active_objs / curr->nr_objs);
|
||||||
stats->nr_active_caches++;
|
stats->nr_active_caches++;
|
||||||
} else
|
} else
|
||||||
curr->use = 0;
|
curr->use = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user