On (22/11/07 11:08), Minchan Kim wrote: [..] > I am thinking like this: > > * Without recomp_algo setup, user can do whatever they want on the fly > > > echo "type=idle threshold=3000 algo=zstd" > recompress > > Later they could do > > echo "type=idle threshold=3000 algo=deflate" > recompress By "without recomp_algo setup" you mean that user doesn't configure anything before `echo XG > zramX/disksize`? Currently algorithm and recomp algorithm need to be selected at the same time - before zram device is initialised, because we use the same code and same approaches: we need to have zcomp back-ends in per-CPU data in zram read/write/recompress. Creating per-CPU zcomps on the fly is probably going to be a little bit intrusive to zram. What I currently have is as follows. A copy paste from my test script: - init device echo "algo=lz4 priority=1" > /sys/block/zram0/recomp_algorithm echo "algo=zstd priority=2" > /sys/block/zram0/recomp_algorithm echo "algo=deflate priority=3" > /sys/block/zram0/recomp_algorithm echo 5G > /sys/block/zram0/disksize Various recompression use cases: - recompress huge pages using all secondary algos in order of priority echo "type=huge" > /sys/block/zram0/recompress - recompress huge pages using zstd only echo "type=huge algo=zstd" > /sys/block/zram0/recompress - recompress all pages using lz4 echo "algo=lz4" > /sys/block/zram0/recompress - recompress idle pages, use all algos in priority order, with threshold echo "type=idle threshold=3000" > /sys/block/zram0/recompress - recompress idle pages, using zstd only, with threshold echo "algo=zstd type=idle threshold=2000" > /sys/block/zram0/recompress