[LTP] [PATCH v4 4/4] zram/zram01.sh: Use mem_used_total field instead of compr_data_size field

Petr Vorel pvorel@suse.cz
Fri Dec 17 09:47:51 CET 2021


Hi,

[ Cc Martin ]

> Before ltp commit 4372f7a2156 ("Fix compression ratio calculation in zram01")[1], we
> used free -m changes to calculate the compression ratio.

> After the above patch, we used compr_data_size to calculate. kernel documentation[2] has
> the following info:
> orig_data_size: uncompressed size of data stored in this disk.
> compr_data_size: compressed size of data stored in this disk
> mem_used_total: the amount of memory allocated for this disk

> We should calculate the compression ratio by used disk size divided into used mem size.
> It can also avoid the situation that division by 0 as below:
> zram01 7 TINFO: filling zram4 (it can take long time)
> zram01 7 TPASS: zram4 was filled with '25568' KB
> zram01 7 TINFO: compr_size 0
>  /opt/ltp/testcases/bin/zram01.sh: line 131: 100 * 1024 * 25568 / 0: division by 0 (error token is "0")

Thank you for addressing this issue. replacing "data *stored* in this disk" with
"*allocated* for this disk" could help (although looking at kernel code
mm_stat_show(), I would not be sure).

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list