From patchwork Mon Sep 5 08:15:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12965749 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 8579EECAAA1 for ; Mon, 5 Sep 2022 08:16:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D965801BC; Mon, 5 Sep 2022 04:16:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1624C801B3; Mon, 5 Sep 2022 04:16:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F1D9C801BC; Mon, 5 Sep 2022 04:16:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id DE69B801B3 for ; Mon, 5 Sep 2022 04:16:14 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1F686121898 for ; Mon, 5 Sep 2022 08:16:13 +0000 (UTC) X-FDA: 79877324226.09.35030D3 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf27.hostedemail.com (Postfix) with ESMTP id CD6C1400AA for ; Mon, 5 Sep 2022 08:16:12 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id jm11so7773852plb.13 for ; Mon, 05 Sep 2022 01:16:12 -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=fBzy0HH3oP/NJNf66NH/BQ/hBL6aSkPOwubVif8FhBg=; b=g7ZLQz5Z/UHV+cJtofiH2bNHxfIGDDEbPms2i+63gWIQo9iEQyAbHkz2T63xkNd232 8HXFrR0soPJ/o36JPaLPBcmaa7Vd3YWV7WQT58naNwRYiytTnSSV3xbgOLXUZNYNacFI OgOIERWJrjBlsBwRdaLwSgka5CKVaWoBSNZl8= 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=fBzy0HH3oP/NJNf66NH/BQ/hBL6aSkPOwubVif8FhBg=; b=oF58JSiBJj9+r++0Cg0VV5LPYZnkrrbIaZ/PYBfWAWi/BS5V0735fan0NTgIR7VuDm mEPJzPb6wccIXkmCT4dNx4xJzouun682CbcDxgguakX76mTGR3NY7CtcleqpGgdn4n/D TiCtjA/FSSEyCdMbue1vBdfZruREkM2EnkxJuEA45Khp742xudkwGf+gloeFoDZMS+CO 4U2ScfjnmToykEDOv1gTx8f/WbgF5By7B2WgBGDda5OI4OLZ044mL0pGvxwZ6soRPdFy WmoH+607eMir4zrpdngYLglKjqWRQFHFQ1AymZXgPK7RfxzJQesM2yjtyGCNbLlr9cfz HUiw== X-Gm-Message-State: ACgBeo2iCo9hCVZRhNXJUCXR2hEExH3dL12g2ierro6dEh5N34g9U0lE vELbPzrlopq/GCqcL+KZf3GBlQ== X-Google-Smtp-Source: AA6agR5A0zJxXzLe1uhfjaa6iSw5p5az5Rm6rkC00HQxMV7jvGbarLvaRVP5N167w0AAR8B/o/OXVw== X-Received: by 2002:a17:902:d2ce:b0:175:994:7778 with SMTP id n14-20020a170902d2ce00b0017509947778mr30962616plc.43.1662365771902; Mon, 05 Sep 2022 01:16:11 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:71e2:8444:42d9:4bb0]) by smtp.gmail.com with ESMTPSA id w12-20020aa79a0c000000b005363bc65bafsm7075864pfj.57.2022.09.05.01.16.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 01:16:11 -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 2/3] zram: Add recompression algorithm choice to Kconfig Date: Mon, 5 Sep 2022 17:15:45 +0900 Message-Id: <20220905081552.2740917-4-senozhatsky@chromium.org> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog In-Reply-To: <20220905081552.2740917-1-senozhatsky@chromium.org> References: <20220905081552.2740917-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=g7ZLQz5Z; spf=pass (imf27.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.176 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=1662365772; a=rsa-sha256; cv=none; b=XGx8NlgPzfq8PJeyKtR6UWZd2/2MiyXerSXl3hFx9PpnoSgLOPkMWbgpbCOC/7N1Y0xxOF L1R2DeyICS5xb4jxCOU2MQx3enu4LwatCKnI5MAf5IWi25UjZhGrCllESYyjafRTnJwbF3 NeGHIiq3t/45lO4CpkPBRftar4SGZ5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662365772; 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=fBzy0HH3oP/NJNf66NH/BQ/hBL6aSkPOwubVif8FhBg=; b=bk0SgzJq43yR7rdn0OLPqrXHo16UIoIM93TnUUbshoNsz0G3k4bqNDG11tCcOlbXC8gvqt rgFEao9g5Fc23tVwEaPCbl+nDNzO9N9C0zkixbBwZcia+jr4hv5E8oCu/E1QOtpDnFdAZn 7strEa2rK+Q3kFkwuqyVaX8YeMrGfn8= X-Rspamd-Server: rspam02 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=g7ZLQz5Z; spf=pass (imf27.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Stat-Signature: w63d45wmugshcx5qotiw5qcs1ie8rxn6 X-Rspamd-Queue-Id: CD6C1400AA X-HE-Tag: 1662365772-413965 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 5f0181d9a69e..f144f31c3c4b 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 };