From patchwork Mon Sep 5 08:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12965773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ECDDECAAA1 for ; Mon, 5 Sep 2022 08:23:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9B07801C9; Mon, 5 Sep 2022 04:23:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4ADC8D0050; Mon, 5 Sep 2022 04:23:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1371801C9; Mon, 5 Sep 2022 04:23:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B0D5E8D0050 for ; Mon, 5 Sep 2022 04:23:49 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 82F73805B0 for ; Mon, 5 Sep 2022 08:23:49 +0000 (UTC) X-FDA: 79877343378.23.4F70A6E Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf05.hostedemail.com (Postfix) with ESMTP id 297B4100072 for ; Mon, 5 Sep 2022 08:23:49 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id y136so3016917pfb.3 for ; Mon, 05 Sep 2022 01:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=/AdpGVT0N/8ncggFEAw2LdRk7MFt3IthPSmEwk0XZqA=; b=LiL4ic6qnwShH+vKAAfDpVgTQC0FxSPXFggKOMKQNFzrWxx/1FeDNFEhP9z1ZoIO2f Wd8EYKuaIk6ket1LJsvuXUY4AKFZe10HIuW6YGeD4RCNyM+xZjuqWjyZvTo7lmuz4JqP sL+P+IsNne+r1gmoWf77QeKPbpDCA0nP5YR4c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=/AdpGVT0N/8ncggFEAw2LdRk7MFt3IthPSmEwk0XZqA=; b=mLyGnSoUmOqwqYo4ru9f2ZF6rnvOq0IUMAN209iFbR6ogtF07D/bX4KhqLbmv/+eIN 8s1+lTqRpdrG00EyejUniuY+Oo6cJ0PdpPFC9kk9PQlRyS2B6qYQe/+sFY5FDdSX6NGK mLDTi6qDspddl4SRvRGTpCZDsmTv5eEvTzU6WfnEJTjoX83fl8ulvhW18SHz6jUjAkA7 ZkZj9VWtXcNNLhqstCkZ365/588mxNwM7HRiDwePeb7DtqgdcWjOBEWYhAW8JLKqlQ5W ixiaY73E+hMLD1qz/lD1XZZzmXh3/OL7cXLEfso928oWh4x1ra+5u39YYaQpBUUOotwm /dGw== X-Gm-Message-State: ACgBeo35Jf8dI7TT8GEws1+7vidomm5OsUHoA7ENrKes4QCH7otElwul al3VGKllF4ahbMJs2xB12+ZC1Q== X-Google-Smtp-Source: AA6agR4UZ885aB4mUVeDufZQeCtDSZclJbHMwybgeqEVVnMUNj3OcY1loqHdvf0STXrAMJAluHjgsA== X-Received: by 2002:a65:6c07:0:b0:41d:9ddd:4266 with SMTP id y7-20020a656c07000000b0041d9ddd4266mr40872332pgu.326.1662366228315; Mon, 05 Sep 2022 01:23:48 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:71e2:8444:42d9:4bb0]) by smtp.gmail.com with ESMTPSA id p14-20020a170902e74e00b001641b2d61d4sm6807093plf.30.2022.09.05.01.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 01:23:47 -0700 (PDT) From: Sergey Senozhatsky To: Minchan Kim , Andrew Morton Cc: Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCH RFC 6/7] zram: Add recompression algorithm choice to Kconfig Date: Mon, 5 Sep 2022 17:23:22 +0900 Message-Id: <20220905082323.2742399-7-senozhatsky@chromium.org> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220905082323.2742399-1-senozhatsky@chromium.org> References: <20220905082323.2742399-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=LiL4ic6q; spf=pass (imf05.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.178 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662366229; a=rsa-sha256; cv=none; b=jgBTmnQWyzRgC83C5rQ/8S42N9Um3Mg8RJpUCkQriXGmU+iAL/KMYflKvoZbhDRYCOJkMw qJbYNAbXIYkVzoeT83Hw1/0kWEwfYQ9jqtvL7YgzjuqIciUh/+orKq0tx2MOctQJ3cbsZF eJIwCQ3bIT2KBIsl2xVOo5c6l5n7rLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662366229; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/AdpGVT0N/8ncggFEAw2LdRk7MFt3IthPSmEwk0XZqA=; b=4INgNqRAwtRTO1rTkTWy4LVoRqdiuVcjtJdmwFcRdHftosJgp6qjCVgABSFxM1sU4RCoD5 JZIysXQl9eAHH//QrFEvu+1Pf6FVQw9iE6+mVQNDyHV8PehQeVkjNR3ByTAa0SfxOuPDYR eqLVr1ncuY3ojrDFkl8S0zcC/zupFYM= X-Stat-Signature: g1oy9wozyc8uz513awtzg9fa5z5g6ifk X-Rspamd-Queue-Id: 297B4100072 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=LiL4ic6q; spf=pass (imf05.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.178 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam07 X-HE-Tag: 1662366229-955807 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Make (secondary) recompression algorithm selectable just like we do it for the (primary) default one. Signed-off-by: Sergey Senozhatsky --- drivers/block/zram/Kconfig | 40 +++++++++++++++++++++++++++++++++++ drivers/block/zram/zram_drv.c | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index 81ae4b96ec1a..fc2d4d66c484 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -89,3 +89,43 @@ config ZRAM_MULTI_COMP echo TIMEOUT > /sys/block/zramX/idle echo SIZE > /sys/block/zramX/recompress + +choice + prompt "Default zram recompression algorithm" + default ZRAM_DEF_RECOMP_ZSTD + depends on ZRAM && ZRAM_MULTI_COMP + +config ZRAM_DEF_RECOMP_LZORLE + bool "lzo-rle" + depends on CRYPTO_LZO + +config ZRAM_DEF_RECOMP_ZSTD + bool "zstd" + depends on CRYPTO_ZSTD + +config ZRAM_DEF_RECOMP_LZ4 + bool "lz4" + depends on CRYPTO_LZ4 + +config ZRAM_DEF_RECOMP_LZO + bool "lzo" + depends on CRYPTO_LZO + +config ZRAM_DEF_RECOMP_LZ4HC + bool "lz4hc" + depends on CRYPTO_LZ4HC + +config ZRAM_DEF_RECOMP_842 + bool "842" + depends on CRYPTO_842 + +endchoice + +config ZRAM_DEF_RECOMP + string + default "lzo-rle" if ZRAM_DEF_RECOMP_LZORLE + default "zstd" if ZRAM_DEF_RECOMP_ZSTD + default "lz4" if ZRAM_DEF_RECOMP_LZ4 + default "lzo" if ZRAM_DEF_RECOMP_LZO + default "lz4hc" if ZRAM_DEF_RECOMP_LZ4HC + default "842" if ZRAM_DEF_RECOMP_842 diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 386e49a13806..8ed41514b8f0 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -44,7 +44,7 @@ static int zram_major; static const char *default_comp_algs[ZRAM_MAX_ZCOMPS] = { CONFIG_ZRAM_DEF_COMP, #ifdef CONFIG_ZRAM_MULTI_COMP - "zstd", + CONFIG_ZRAM_DEF_RECOMP, #endif };