From 99d71ad5810b8fbfab5c4c6be97f3e86953b6157 Mon Sep 17 00:00:00 2001 From: Takayuki Nagata Date: Mon, 25 Apr 2016 05:30:36 -0400 Subject: [PATCH] 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 --- proc/slab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc/slab.c b/proc/slab.c index 444b79cc..2d7f9678 100644 --- a/proc/slab.c +++ b/proc/slab.c @@ -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; 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++; } else curr->use = 0;