Re: [PATCHv4 4/9] zram: Introduce recompress sysfs knob

From: Sergey Senozhatsky
Date: Fri Nov 04 2022 - 19:23:08 EST


On (22/11/04 10:27), Minchan Kim wrote:
> > objects that are in-compressible (in a way that saves us memory in
> > zsmalloc) by any of the ZRAM's algorithms.
> >
> > > read_block_state
> > > zram_algo_idx(zram, index) > 0 ? 'r' : '.');
> > >
> > > zram_read_from_zpool
> > > if (zram_algo_idx(zram, idx) != 0)
> > > idx = 1;
> >
> > As an idea, maybe we can store everything re-compression related
> > in a dedicated meta field? SKIP flag, algorithm ID, etc.
> >
> > We don't have too many bits left in ->flags on 32-bit systems. We
> > currently probably need at least 3 bits - one for RECOMP_SKIP and at
> > least 2 for algorithm ID. 2 bits for algorithm ID put us into situation
> > that we can have only 00, 01, 10, 11 as IDs, that is maximum 3 recompress
> > algorithms: 00 is the primary one and the rest are alternative ones.
> > Maximum 3 re-compression algorithms sounds like a reasonable max value to
> > me. Yeah, maybe we can use flags bits for it.
>
> If possbile, let's go with those three bits into flags since we could
> factor them out into dedicated field, anytime later since it's not ABI.

Ack.