mbox series

[0/5] mm: unify default compressor algorithm for zram/zswap

Message ID 20240223035548.2591882-1-wangkefeng.wang@huawei.com (mailing list archive)
Headers show
Series mm: unify default compressor algorithm for zram/zswap | expand

Message

Kefeng Wang Feb. 23, 2024, 3:55 a.m. UTC
Both zram and zswap are used to reduce memory usage by compressing cold
page, a default compressor algorithm is selected from kinds of compressor
algorithm as the default one from very similar Kconfig, also both of
them could change the algorithm by sysfs interfaces, so unify the
default compressor algorithm to cleanup the default algorithm chosen.

Kefeng Wang (5):
  zram: zcomp: remove zcomp_set_max_streams() declaration
  zram: make zram depends on SWAP
  zram: support deflate compressor
  mm: zswap: default to lzo-rle instead of lzo
  mm: unify default compressor algorithm for zswap and zram

 Documentation/admin-guide/mm/zswap.rst     |   2 +-
 arch/loongarch/configs/loongson3_defconfig |   2 +-
 drivers/block/zram/Kconfig                 |  44 +------
 drivers/block/zram/zcomp.c                 |   3 +
 drivers/block/zram/zcomp.h                 |   1 -
 drivers/block/zram/zram_drv.c              |   2 +-
 mm/Kconfig                                 | 134 +++++++++++----------
 mm/zswap.c                                 |   8 +-
 8 files changed, 83 insertions(+), 113 deletions(-)

Comments

Yosry Ahmed Feb. 23, 2024, 4:46 a.m. UTC | #1
On Thu, Feb 22, 2024 at 7:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>
> Both zram and zswap are used to reduce memory usage by compressing cold
> page, a default compressor algorithm is selected from kinds of compressor
> algorithm as the default one from very similar Kconfig, also both of
> them could change the algorithm by sysfs interfaces, so unify the
> default compressor algorithm to cleanup the default algorithm chosen.

Both zswap and zram *can* be used for compressed swap, but zram is a
generic block device that has other use cases, see
https://docs.kernel.org/admin-guide/blockdev/zram.html.

For starters, making zram depend on SWAP may break some of those use cases.

Otherwise, I don't immediately see the benefit of unifying the config
options for two independent subsystems just because they both use
"compression". The reduction of the config options is nice, but in
this case I am not sure it's doing more good than harm. Also, most
people use either zswap or zram in my experience, so they don't really
have to configure both anyway.

>
> Kefeng Wang (5):
>   zram: zcomp: remove zcomp_set_max_streams() declaration
>   zram: make zram depends on SWAP
>   zram: support deflate compressor
>   mm: zswap: default to lzo-rle instead of lzo
>   mm: unify default compressor algorithm for zswap and zram
>
>  Documentation/admin-guide/mm/zswap.rst     |   2 +-
>  arch/loongarch/configs/loongson3_defconfig |   2 +-
>  drivers/block/zram/Kconfig                 |  44 +------
>  drivers/block/zram/zcomp.c                 |   3 +
>  drivers/block/zram/zcomp.h                 |   1 -
>  drivers/block/zram/zram_drv.c              |   2 +-
>  mm/Kconfig                                 | 134 +++++++++++----------
>  mm/zswap.c                                 |   8 +-
>  8 files changed, 83 insertions(+), 113 deletions(-)
>
> --
> 2.27.0
>
Sergey Senozhatsky Feb. 23, 2024, 4:51 a.m. UTC | #2
On (24/02/23 11:55), Kefeng Wang wrote:
> 
> Both zram and zswap are used to reduce memory usage by compressing cold
> page, a default compressor algorithm is selected from kinds of compressor
> algorithm as the default one from very similar Kconfig, also both of
> them could change the algorithm by sysfs interfaces, so unify the
> default compressor algorithm to cleanup the default algorithm chosen.
> 
> Kefeng Wang (5):
>   zram: zcomp: remove zcomp_set_max_streams() declaration

I'm afraid this (1/5) is the only patch in the series that we can land.

The rest of the series doesn't look beneficial nor correct.  Sorry.

>   zram: make zram depends on SWAP
>   zram: support deflate compressor
>   mm: zswap: default to lzo-rle instead of lzo
>   mm: unify default compressor algorithm for zswap and zram
Kefeng Wang Feb. 23, 2024, 6:43 a.m. UTC | #3
On 2024/2/23 12:46, Yosry Ahmed wrote:
> On Thu, Feb 22, 2024 at 7:56 PM Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
>>
>> Both zram and zswap are used to reduce memory usage by compressing cold
>> page, a default compressor algorithm is selected from kinds of compressor
>> algorithm as the default one from very similar Kconfig, also both of
>> them could change the algorithm by sysfs interfaces, so unify the
>> default compressor algorithm to cleanup the default algorithm chosen.
> 
> Both zswap and zram *can* be used for compressed swap, but zram is a
> generic block device that has other use cases, see
> https://docs.kernel.org/admin-guide/blockdev/zram.html.
> 
> For starters, making zram depend on SWAP may break some of those use cases.
> 
> Otherwise, I don't immediately see the benefit of unifying the config
> options for two independent subsystems just because they both use
> "compression". The reduction of the config options is nice, but in
> this case I am not sure it's doing more good than harm. Also, most
> people use either zswap or zram in my experience, so they don't really
> have to configure both anyway.
Fair enough, then, please ignore the patches, thanks.
> 
>>
>> Kefeng Wang (5):
>>    zram: zcomp: remove zcomp_set_max_streams() declaration
>>    zram: make zram depends on SWAP
>>    zram: support deflate compressor
>>    mm: zswap: default to lzo-rle instead of lzo
>>    mm: unify default compressor algorithm for zswap and zram
>>
>>   Documentation/admin-guide/mm/zswap.rst     |   2 +-
>>   arch/loongarch/configs/loongson3_defconfig |   2 +-
>>   drivers/block/zram/Kconfig                 |  44 +------
>>   drivers/block/zram/zcomp.c                 |   3 +
>>   drivers/block/zram/zcomp.h                 |   1 -
>>   drivers/block/zram/zram_drv.c              |   2 +-
>>   mm/Kconfig                                 | 134 +++++++++++----------
>>   mm/zswap.c                                 |   8 +-
>>   8 files changed, 83 insertions(+), 113 deletions(-)
>>
>> --
>> 2.27.0
>>
Kefeng Wang Feb. 23, 2024, 6:45 a.m. UTC | #4
On 2024/2/23 12:51, Sergey Senozhatsky wrote:
> On (24/02/23 11:55), Kefeng Wang wrote:
>>
>> Both zram and zswap are used to reduce memory usage by compressing cold
>> page, a default compressor algorithm is selected from kinds of compressor
>> algorithm as the default one from very similar Kconfig, also both of
>> them could change the algorithm by sysfs interfaces, so unify the
>> default compressor algorithm to cleanup the default algorithm chosen.
>>
>> Kefeng Wang (5):
>>    zram: zcomp: remove zcomp_set_max_streams() declaration
> 
> I'm afraid this (1/5) is the only patch in the series that we can land.
> 
> The rest of the series doesn't look beneficial nor correct.  Sorry.

OK, please ignore the reset of patches, Andrew, could you only pick the 
first one, thanks.

> 
>>    zram: make zram depends on SWAP
>>    zram: support deflate compressor
>>    mm: zswap: default to lzo-rle instead of lzo
>>    mm: unify default compressor algorithm for zswap and zram