• Sergey Senozhatsky's avatar
    zram: add recompression algorithm sysfs knob · 001d9273
    Sergey Senozhatsky authored
    Introduce recomp_algorithm sysfs knob that controls secondary algorithm
    selection used for recompression.
    
    We will support up to 3 secondary compression algorithms which are sorted
    in order of their priority.  To select an algorithm user has to provide
    its name and priority:
    
      echo "algo=zstd priority=1" > /sys/block/zramX/recomp_algorithm
      echo "algo=deflate priority=2" > /sys/block/zramX/recomp_algorithm
    
    During recompression zram iterates through the list of registered
    secondary algorithms in order of their priorities.
    
    We also have a short version for cases when there is only
    one secondary compression algorithm:
    
      echo "algo=zstd" > /sys/block/zramX/recomp_algorithm
    
    This will register zstd as the secondary algorithm with priority 1.
    
    Link: https://lkml.kernel.org/r/20221109115047.2921851-3-senozhatsky@chromium.orgSigned-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
    Acked-by: default avatarMinchan Kim <minchan@kernel.org>
    Cc: Alexey Romanov <avromanov@sberdevices.ru>
    Cc: Nhat Pham <nphamcs@gmail.com>
    Cc: Nitin Gupta <ngupta@vflare.org>
    Cc: Suleiman Souhlal <suleiman@google.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    001d9273
zram_drv.c 53.8 KB