]> granicus.if.org Git - procps-ng/commit
libprocps: use float to calculate %use of slabtop
authorTakayuki Nagata <tnagata@redhat.com>
Thu, 4 Aug 2016 09:06:06 +0000 (18:06 +0900)
committerTakayuki Nagata <tnagata@redhat.com>
Wed, 12 Oct 2016 07:59:01 +0000 (16:59 +0900)
commit23ba442c886f6250d1068a82fb7d0fc544acfd63
treeabb17d6882b9f03ccb68940d8f5383038d7654b0
parent636b48efd8a441543b6eec5c5d4cb2d119adcb75
libprocps: use float to calculate %use of slabtop

In some environments, 100 * nr_active_objs is calculated at first,
and the result of lower 32bits is divided by nr_objs. This occurs
even in a 64-bit architecture. So nr_active_objes > 42949672, %use
will be incorrect.

This fix casts type of nr_active_objs to float to calculate
correctly the %use in 32-bit/64-bit architectures.

Signed-off-by: Takayuki Nagata <tnagata@redhat.com>
proc/slab.c