From patchwork Sun Oct 9 09:07:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13001949 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 B0687C433FE for ; Sun, 9 Oct 2022 09:07:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BEE66B007B; Sun, 9 Oct 2022 05:07:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 46E1D6B007D; Sun, 9 Oct 2022 05:07:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30F19900002; Sun, 9 Oct 2022 05:07:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 214B96B007B for ; Sun, 9 Oct 2022 05:07:43 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E685BAB271 for ; Sun, 9 Oct 2022 09:07:42 +0000 (UTC) X-FDA: 80000833164.13.104D63A Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf13.hostedemail.com (Postfix) with ESMTP id 4F19E20020 for ; Sun, 9 Oct 2022 09:07:42 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id n7so8087192plp.1 for ; Sun, 09 Oct 2022 02:07:41 -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 :message-id:reply-to; bh=4cZ+puyQMSIB+n8E0d97j6XHSOdtq59YpKkyki1VJU8=; b=EgKwRSilPm7p4CO1u8/fIzwBKtIVXSWTmIsbJOKy4/04UduO4fKhE+2bWFSK6PWTy7 MUs1CmVg66IhdIP7LBiQ3/atcqWn26lPXRjdKFSnnEXRcmOc+F9INsSAneuaKX1eiKEB 7yEG45dA0ijTgitSeK72Gyqzf24vDXZ6hjyLY= 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:message-id:reply-to; bh=4cZ+puyQMSIB+n8E0d97j6XHSOdtq59YpKkyki1VJU8=; b=zokGAAREs7iYz+XRgdn3NExKSaw0uswmIV/miCYVNrs5CW8PHEFnw1kzjxa29cNd04 X2I0ePDdFJOfxGtdJKUw6gOzFvPkT9wUpX077mXoOOEnq5MNtN/EDqr967UWfe2Bh3zl dx/OSkxG6hez8FlkanQPpezAoOwBTX4LNwyhqhpw27W+DOJQ119YX2YRj+k7USAG5ejl gskCiUttQ8INFHZWs0sMSoc1KL9QfhQX77vzlTGE9Y4hR4vm68bpNO0rb73Qi/h6fs+X MtGvE6UogP4sZcQpiKS6VebjzlI8Kh1fzoEqDfWVx71xS+RoViZdbYt4FTe1fHJuuII8 iKgQ== X-Gm-Message-State: ACrzQf1FsdRKG2Smi99Kg8SH3HGJaYZHi6mei1U4dqZ8sB8TK0MkOkYA mSxnFMbHfVFY+M2jNJ9GLjPDOA== X-Google-Smtp-Source: AMsMyM6wBamnMbzu7YlLUOWaIL8i996NZuN+u1yUYf1GbwAo3RpqMwn47tLv84VDFkbJMphI+eG9ag== X-Received: by 2002:a17:902:ec83:b0:17c:afb3:d1ec with SMTP id x3-20020a170902ec8300b0017cafb3d1ecmr13185807plg.172.1665306461306; Sun, 09 Oct 2022 02:07:41 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:8517:d51e:5fe9:9be7]) by smtp.gmail.com with ESMTPSA id q194-20020a632acb000000b00439d071c110sm4335148pgq.43.2022.10.09.02.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Oct 2022 02:07:41 -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: [PATCHv3 6/8] zram: Add recompression algorithm choice to Kconfig Date: Sun, 9 Oct 2022 18:07:18 +0900 Message-Id: <20221009090720.1040633-7-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.rc1.362.ged0d419d3c-goog In-Reply-To: <20221009090720.1040633-1-senozhatsky@chromium.org> References: <20221009090720.1040633-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665306462; a=rsa-sha256; cv=none; b=ZpL/6GDlyLi/XTFatlb1U3RXWEoTRx7A5SU89xpGX6nHCjDhqEPSSedo1ICSdiMOJUBjUK I3jf5H1mjuD4cEtRgbOt9AYn3AGDtsmJ18uBHOK1A/Q3wAO8xBsBEKwv5t6g9VFfH3XcUv HL7nGnOErVv3rwpB+/lOFk8TJehW058= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=EgKwRSil; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf13.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665306462; 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=4cZ+puyQMSIB+n8E0d97j6XHSOdtq59YpKkyki1VJU8=; b=Pf1C237W0Z6JTn+XxG7SgYpncoEfBP9nxiYYs+1qXeS1yuuIVvCY7/ZrigQ6eM6B+SjBcb G204Y9S0w2CHdTelbzruuix4NdS4VXl6s9LMBVotbeiwIn0jpybv0WYW71SSmE1lk02Z5A KpuEtMDozAPdqpuKBUqLN3KTt4xP6iI= X-Stat-Signature: hxpmgnnsihpaskw6eataqxf7hjt9h344 X-Rspamd-Queue-Id: 4F19E20020 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=EgKwRSil; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf13.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1665306462-476119 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 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 143c33bd6783..7285a85b4054 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 };