From patchwork Wed Oct 5 02:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12998839 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 675E0C433F5 for ; Wed, 5 Oct 2022 02:40:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 027A36B007D; Tue, 4 Oct 2022 22:40:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF2946B007E; Tue, 4 Oct 2022 22:40:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D44506B0080; Tue, 4 Oct 2022 22:40:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BF71E6B007D for ; Tue, 4 Oct 2022 22:40:38 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 94F78160E5E for ; Wed, 5 Oct 2022 02:40:38 +0000 (UTC) X-FDA: 79985342556.25.3CB2CA1 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf06.hostedemail.com (Postfix) with ESMTP id 2F312180003 for ; Wed, 5 Oct 2022 02:40:37 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id i7-20020a17090a65c700b0020ad9666a86so540084pjs.0 for ; Tue, 04 Oct 2022 19:40:37 -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=XWoWvn6QLYmkZfKsLskYp8R1UWJ07QB0khsqO1xI030=; b=j9KV+AyeW0jwezvi5/7/uJWlhOJi/pvUDSLhxR2V+HoNvgDu2rKXYpM/RnnkoJ1D3r 2feDyqGE61vObJ5SyznPn+z9BypLv8OcLdJiHqiobO2nXUfYZ2ulMO00MrxBOUET2b7L 7JirWhoT/PetJ3qKcOXBnlXsKhCJe0WXcJqiw= 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=XWoWvn6QLYmkZfKsLskYp8R1UWJ07QB0khsqO1xI030=; b=nqC0QhOzJV4ZlJElN88kEiJHXiLvSlWCtkckZHVh3b62iuC8v1WU7B2qWQaAB8YXoj MYqtkBjwaIS4+RnDC6cMuHm02ZAK2OFSvpv8wiMM0aon8Lkux5plHopCneBYsL83gdcr 4Ixklfua6Nlv3UmexvoUZDYQczLBeKMS8jo6h0eud+AEjUAZZjXnhnCM+sC/R9sxAfOx 7nTPU9wwE+17Vb3+esDCabelaqv/owzUG4J2O/n9/2bPMnJQ9meSGOLdK0Xcwnm37Q+X ndfmZamjnzpN4Gv22+vJ0AsyLxrCgfRwUVraSrPQ29gChgjbLn5K5RR6wRa91umKQGbX 6dSQ== X-Gm-Message-State: ACrzQf08VKRCnAQJqLdIByJfyudf0JRuTxxw9Lzzr2+3RU4afOd87PAK ywVVVIzdwz4HCXyfLFLLv1DxDg== X-Google-Smtp-Source: AMsMyM7sTr5/lG0VbDXKXmsnvqJ4QLG7VodsT4AHL9ItMxEzciwN7QsvDq5BXnvrwAaOhOdYV7NqTg== X-Received: by 2002:a17:903:2684:b0:17b:7568:ffea with SMTP id jf4-20020a170903268400b0017b7568ffeamr29040217plb.128.1664937637205; Tue, 04 Oct 2022 19:40:37 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:a9d9:6396:ee12:8be8]) by smtp.gmail.com with ESMTPSA id a14-20020aa794ae000000b00561e010a309sm1673579pfl.19.2022.10.04.19.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Oct 2022 19:40:36 -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: [PATCHv2 6/8] zram: Add recompression algorithm choice to Kconfig Date: Wed, 5 Oct 2022 11:40:12 +0900 Message-Id: <20221005024014.22914-7-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221005024014.22914-1-senozhatsky@chromium.org> References: <20221005024014.22914-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664937638; a=rsa-sha256; cv=none; b=lniX0MuIf/c4pHElkd+ljTDHsOZm8cR1hqy72TZG/J+lSJk9b0Im453C61s05Y0mJr9DLv m7eP6tOqpDjSxrm5iTwJjIWt+n0lEkYhwmc1SOOEdRxBBlxHHO3LydBWH1Pco5UclwW1nN XQwqK2yOF3GF3aGcove9R979v+JVb20= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=j9KV+Aye; spf=pass (imf06.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.50 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664937638; 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=XWoWvn6QLYmkZfKsLskYp8R1UWJ07QB0khsqO1xI030=; b=SIwKyp2JqQKH2KUZR3Csw1tfY7g0jR4+DUvCsOsrm6hnJYl1ZfYnkKshYaUVViPV4LAEjE 57yJrOOnGp8W0l0GWMkFiGQhyE7uFLq0I/NN0epiINCuqxeI7xY/phvuINYtiFaMuvXoLP SzmzaIewEdQ567Vp+GvGE5WyRjLUbcQ= X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: 2F312180003 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=j9KV+Aye; spf=pass (imf06.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.216.50 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: f3sfcr8rhg9ook5zrgiogaroaebsyz18 X-HE-Tag: 1664937637-135093 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 7febf36e93eb..442885ac72ca 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -90,3 +90,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 077a0bc60b8d..75fc89de21e3 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 };