Re: [PATCHv2 1/4] zsmalloc: rework zspage chain size selection

From: Minchan Kim
Date: Fri Jan 13 2023 - 12:45:27 EST


On Mon, Jan 09, 2023 at 12:38:35PM +0900, Sergey Senozhatsky wrote:
> Computers are bad at division. We currently decide the best
> zspage chain size (max number of physical pages per-zspage)
> by looking at a `used percentage` value. This is not enough
> as we lose precision during usage percentage calculations
> For example, let's look at size class 208:
>
> pages per zspage wasted bytes used%
> 1 144 96
> 2 80 99
> 3 16 99
> 4 160 99
>
> Current algorithm will select 2 page per zspage configuration,
> as it's the first one to reach 99%. However, 3 pages per zspage
> waste less memory.
>
> Change algorithm and select zspage configuration that has
> lowest wasted value.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@xxxxxxxxxxxx>
Acked-by: Minchan Kim <minchan@xxxxxxxxxx>