Re: [PATCHv3 4/8] zram: Introduce recompress sysfs knob

From: Andrew Morton
Date: Mon Oct 17 2022 - 20:12:47 EST


On Sun, 9 Oct 2022 18:07:16 +0900 Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx> wrote:

> Allow zram to recompress (using secondary compression streams)
> pages. We support three modes:
>
> 1) IDLE pages recompression is activated by `idle` mode
>
> echo idle > /sys/block/zram0/recompress
>
> 2) Since there may be many idle pages user-space may pass a size
> watermark value and we will recompress IDLE pages only of equal
> or greater size:
>
> echo 888 > /sys/block/zram0/recompress

It's helpful to describe the units ("bytes") here and in the
docmentation.

> 3) HUGE pages recompression is activated by `huge` mode
>
> echo huge > /sys/block/zram0/recompress
>
> 4) HUGE_IDLE pages recompression is activated by `huge_idle` mode
>
> echo huge_idle > /sys/block/zram0/recompress
>
> ...
>
> + if (IS_ERR((void *)handle_next)) {

IS_ERR_VALUE() avoids castsing back and forth.