From patchwork Tue Oct 18 04:55:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13009907 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 CAD1FC433FE for ; Tue, 18 Oct 2022 04:55:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 66E668E0001; Tue, 18 Oct 2022 00:55:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 644D26B0081; Tue, 18 Oct 2022 00:55:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 496228E0001; Tue, 18 Oct 2022 00:55:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3BF5B6B0080 for ; Tue, 18 Oct 2022 00:55:58 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0FF5E1C6314 for ; Tue, 18 Oct 2022 04:55:58 +0000 (UTC) X-FDA: 80032857996.21.C1BFA07 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by imf16.hostedemail.com (Postfix) with ESMTP id AB09E18002D for ; Tue, 18 Oct 2022 04:55:57 +0000 (UTC) Received: by mail-pf1-f180.google.com with SMTP id d10so13037091pfh.6 for ; Mon, 17 Oct 2022 21:55:57 -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=u6FdlTaAeoJZnsdClOVvKEq4lJg+XPWe1oKWdw8/hCk=; b=mGht8IGExOGxSDdSigMACLR7r+oqEPBhqmdFZwzcCZbnhwEIwDlx8IUzwUJ2oNN4mf yI7zRshfGlUr4VjyEIYcQm9A+xqAcUqq0SHRcig+dl2PYPG/RiYazZ4zPKWAYc9FFzju 6vDXIdBf+phqB93FKQYUwUmhyALJr9U293+wA= 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=u6FdlTaAeoJZnsdClOVvKEq4lJg+XPWe1oKWdw8/hCk=; b=uy9jLipsHlm81s52fEqmOkvgmQ8fmH4ZCSj4ExVPNi6hdalO21AyaQpyoMtlYkp7vH fjYglpMoxSf3oUPT8bgWlLL2ZGy7YiRcAKFcrH8rEUIQk2ccegs9Nrc0LjPB22knaS2t +Eqa5OBBR/0s45IkQGJ3AbV8S8obR23zsYY5t7V4X+mpEHkRYqsdj4mOXDUDB9yj7wkj YaUdawUUOEHKeaiSebawCoPopDxKrR6VTvk4yiTAGmiCr5TSn29LoWXhJGUUyAyhsq2l 89m9OahkEpP+IblM9WAqP9VJyY3O0G3svfa5KVqIWniSGVKEryWbdKgZ5U+fAQBmeBas BuvA== X-Gm-Message-State: ACrzQf1AUP+QD6Ge5iFPtcCpz37G2RhfZiGLX77Quv5UUS5X1P2CaRJv boBzfacAIBdIA6q3dC7a+olyC9k+qAGkGg== X-Google-Smtp-Source: AMsMyM6g/QL3RczfjsbLh8zvYrP191iu/ZlPb5PzgxBWDVBC98pOVFGn60QYUSh3PKf4EuHzV0UVLw== X-Received: by 2002:a05:6a00:1ad0:b0:564:a791:42dc with SMTP id f16-20020a056a001ad000b00564a79142dcmr1116320pfv.50.1666068956740; Mon, 17 Oct 2022 21:55:56 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:17a9:73b0:c262:eccd]) by smtp.gmail.com with ESMTPSA id p4-20020a170902e74400b0017b69f99321sm7549220plf.219.2022.10.17.21.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 21:55:56 -0700 (PDT) From: Sergey Senozhatsky To: Andrew Morton , Minchan Kim Cc: Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv4 6/9] zram: Add recompression algorithm choice to Kconfig Date: Tue, 18 Oct 2022 13:55:30 +0900 Message-Id: <20221018045533.2396670-7-senozhatsky@chromium.org> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog In-Reply-To: <20221018045533.2396670-1-senozhatsky@chromium.org> References: <20221018045533.2396670-1-senozhatsky@chromium.org> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1666068957; a=rsa-sha256; cv=none; b=xw9RniOFSLzMP/JRhZ1ueYyV+0y80gz5nCjxxgbQS86n5AA4Le620ctv7PAJuOAAG8MXOa 9CuCSYNH6GbS+1X80LJLITwMCk69CbZdvnkwFgH2OgNobX2po84zHKGUanJJINKueG5was ryNpGf3nkyhUYt2DZDvSV9zkftARuVY= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=mGht8IGE; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.180 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=1666068957; 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=u6FdlTaAeoJZnsdClOVvKEq4lJg+XPWe1oKWdw8/hCk=; b=r0m0L0ZvMKWp+dSuMDyYpP26usZ2ka10JmortJSNH9zle6/OenejxeMNOlkh1DB8ol9GAh 8mhPDRZhdAlOK0sLqcKVMpm6P3PE9eeyRVQx7yAQPJaOAolqW3zasCx8FYpVB/NN9PntHY 69uOx/6UoVSVUllEsqzMwjSaa6+8F4k= X-Rspamd-Queue-Id: AB09E18002D Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=mGht8IGE; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf16.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.210.180 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Rspam-User: X-Rspamd-Server: rspam08 X-Stat-Signature: ktsm4o8tx8mbjpugn97k6tpuor8yp6sw X-HE-Tag: 1666068957-769298 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 3e00656a6f8a..076a76cd1664 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -93,3 +93,43 @@ config ZRAM_MULTI_COMP SIZE (in bytes) parameter sets the object size watermark: idle objects that are of a smaller size will not get recompressed. + +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 da11560ecf70..1e9561217466 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 };