From patchwork Fri Feb 23 03:55:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13568551 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 AEF1EC54798 for ; Fri, 23 Feb 2024 03:56:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 544446B007B; Thu, 22 Feb 2024 22:56:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F5C36B007D; Thu, 22 Feb 2024 22:56:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D2136B007E; Thu, 22 Feb 2024 22:56:09 -0500 (EST) 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 1802A6B007B for ; Thu, 22 Feb 2024 22:56:09 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id E4F661A0FAD for ; Fri, 23 Feb 2024 03:56:08 +0000 (UTC) X-FDA: 81821705616.05.693B575 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf22.hostedemail.com (Postfix) with ESMTP id E9527C000D for ; Fri, 23 Feb 2024 03:56:04 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708660565; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R0nOSNZsb4CeAnXpl60Oul9hhJXj4s1J4+DM00CqciI=; b=V0LMGW4L4YhxBUV6BO2igNz1pbfGic1vRl1KNJbfs6fGQVP75tgMrxnqWVv3vcBu7QyXXk IEjdZT2k8GIyzZd8KazFFXDIaoVgyRjRho7yeFqjgfV5NOY0pQOs5jEkXFg+oXMv5qHVKp PG1EpNDZpE34fqhNsltWXTrDbKI3V/s= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708660565; a=rsa-sha256; cv=none; b=MYntfm3fUpIlOHjbrdEm66Z2FqYBQiQ2gsFd0mpGHxecx5Nhj3a7BAKRZQi3JFHPHD2wzs Y80cwLsxIcE46mNRYWmlxx/EJK+sJzBF3beQ0tTPXfUkmzwN811Al0DczjsF3/IQZ/A/Xh 0b+nGFo3B0Qha7kXgRo9KHKj189Cozg= Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Tgx3J0qT7z1xpBD; Fri, 23 Feb 2024 11:54:36 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 92D6C140136; Fri, 23 Feb 2024 11:56:00 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 11:55:59 +0800 From: Kefeng Wang To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton CC: Chengming Zhou , Huacai Chen , Minchan Kim , Sergey Senozhatsky , , , Kefeng Wang Subject: [PATCH 1/5] zram: zcomp: remove zcomp_set_max_streams() declaration Date: Fri, 23 Feb 2024 11:55:44 +0800 Message-ID: <20240223035548.2591882-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> References: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspam-User: X-Stat-Signature: righwwtww8f6frhrc4ym76snyfh3hntc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E9527C000D X-HE-Tag: 1708660564-672627 X-HE-Meta: U2FsdGVkX1/jBXSRhmCO35skLF4XeqpHwonv162J8l88e5bUXVSHYE3VQrG9e1BFxg4kT9XLQidfSok7vLD3GB5GIsPHpmDRKQx9nLslrpZ40SrORlIS2CbEMRin4psIixIdfKbgML8IYxUb+v1F9dfvcrcTPqZKSCDUvUhXU6GQBjgabmWrOpFq4vpIdQU9WE2xcTmi1HZ3jSJtmvIUPcohbpaZXPISQeAadGeHkhXXQY23lax7jbJeX6GpNNGE9aanSR7dcJldfNMqdryeMf6P0M4C0C7DpbaEXibJghkiH5pb1X8j32CVLm4Y2VQF9AT8dlKzyFpifpygBg7zvwt8ByspUualIQ2VKberDu9pAiS4S/qWTL+QI3XkG1UN+7KutBHc7Riaq3dpPc4Sp7f/CFfR9OrFrk614Yi8nRsRBmnCg6Oiv/IIKuR1H3INmR02UQJBvXyMBAV1PkHfzBclQz7wJjEFDsMcKNG2VGKanrMAVhfsxaPutWnqhku2ZyT5qxsR5rkK43LezZUFqjWOCwW+u2PDdh+l5lSVfQqs//9cu4X//oRbtCX6lKxnPyCPrF3moIbJXEJmlsY2FzISEkjMzLojIWGddRahPXm8HFWogXx14nkZu0X8W9coV4fmj0DW1l/e2QSP/c3l1BhD6wT1WKubceQHcWH7NJjO6J+3Fbhzein+S5DOHcTgrswjb/6cNDVs96aPVHFnxs5Ix56Kn41qf7gzLKHT/hid7BMrKVVoTNLg/OmiWcgZ/MwOuYeSX32CtTOqE40EXRsLXUocpOuUuR5o//Y+Bnby3KHXg1jbSXaQFg2Jw7rPtTtsLOSsTZi+lihaSIdQPIOEZC4dBI2Q+2Xtj1doToKLQl12DR0t3cMJ0GJyhVVyXoTPzWvA1Tk= 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: List-Subscribe: List-Unsubscribe: The zcomp_set_max_streams() is removed from commit 43209ea2d17a ("zram: remove max_comp_streams internals"), remove the declaration. Signed-off-by: Kefeng Wang --- drivers/block/zram/zcomp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h index cdefdef93da8..e9fe63da0e9b 100644 --- a/drivers/block/zram/zcomp.h +++ b/drivers/block/zram/zcomp.h @@ -39,5 +39,4 @@ int zcomp_compress(struct zcomp_strm *zstrm, int zcomp_decompress(struct zcomp_strm *zstrm, const void *src, unsigned int src_len, void *dst); -bool zcomp_set_max_streams(struct zcomp *comp, int num_strm); #endif /* _ZCOMP_H_ */ From patchwork Fri Feb 23 03:55:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13568550 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 E83BBC54E41 for ; Fri, 23 Feb 2024 03:56:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73ED56B0078; Thu, 22 Feb 2024 22:56:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F2E86B007B; Thu, 22 Feb 2024 22:56:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5B5F86B007D; Thu, 22 Feb 2024 22:56:08 -0500 (EST) 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 4D7B86B0078 for ; Thu, 22 Feb 2024 22:56:08 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2023CA10F5 for ; Fri, 23 Feb 2024 03:56:08 +0000 (UTC) X-FDA: 81821705616.09.D7B04D1 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 019EB120012 for ; Fri, 23 Feb 2024 03:56:05 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708660566; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BnNOCUADY5Lb436MiE6zJO9qDKzZTY0YsYH11jhUX70=; b=z2hiflxCr003j+lhWy2sPwItBShXC3LQJVX0YUo7NrE0Lcd3VqP95WdWonZl1VSSI5FT7p BhZVfBDYp3xTk4yihUs/IZ2vdsw+LS1xi/c2dnk/JmSscRZU3T90BrUtGVs3jYcjXjKBHB 5Nc9IvDaRd/4l7wd1cjZiGwt/Jekav0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf29.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.32 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708660566; a=rsa-sha256; cv=none; b=035Ue/hqgfHTrnK2IUu8w7MiQSp8llLfEM46sYI9IDChQHloguudNdn5P/ZHYksN1eSD2R fHz03GlBiIW1HmL+RsENN4D2GWLeSUfyllte1GexHms3RP8ZLINwVtuKrIk+S3pdSwEtgA Y3J1LSft9UA+u0R2IgUxQ+dVJtFYHpw= Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Tgx4G1kvhz1vtxj; Fri, 23 Feb 2024 11:55:26 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 2A7911A016C; Fri, 23 Feb 2024 11:56:01 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 11:56:00 +0800 From: Kefeng Wang To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton CC: Chengming Zhou , Huacai Chen , Minchan Kim , Sergey Senozhatsky , , , Kefeng Wang Subject: [PATCH 2/5] zram: make zram depends on SWAP Date: Fri, 23 Feb 2024 11:55:45 +0800 Message-ID: <20240223035548.2591882-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> References: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspam-User: X-Stat-Signature: 9bw7ksmxg7j4wai8s6s6jss4mboqryuc X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 019EB120012 X-HE-Tag: 1708660565-964330 X-HE-Meta: U2FsdGVkX1/jH4/VyRrghp3jEkcZugyVp/X6akniEVMluJA62Hu0op3mxcTahsorUQji6TAc6qCvbnpF5J0UtR0W/E12d+nWQ97OWuDkkAaE91ay5UbHVTbgU3HmN7I18L5XXdMw2TyYEaND+zFeWQCQd4mbiv69RT7CvUHUnjSKr/rP9LEKHDRb3op+8oZVsA4moFjioTmBGEudb1K41Ca8cyTO87fezemyQMyjLB1X5mmZI7mkEhWmMG1ok1iqsQr6qJUQMyIyNfu8QgvmexmCNkqSS/OSmyu8JlzrN+P1MQUWSdxq3ggXcmp1GIwac1XpKdXRlPk0UtuybJU+aofo+9y2PivqjG1f+FTAht3m7MWi6XKVnbSgZkx7lCJmQZbSuk9jl89mctgo3iBxVL9oUw+m9lZIUffn50/WbTzpmUIiXUJjs9GOEut5fDg3vI4Sh4RKxEALKCj/x/7l1j0BN5vlkpf7tqOBSBgXN3tBj2QG3857FftbwSArPkfq67et2GqHTp86sRbfMNwJFgxAQzlw1WLX7n4iFqNhaENWCkFHydFXi+gW5YgQmXibJwaSh/PTzYbXV+rFH+UXpkoUI507Ndg9JtbfGAiVD3bMXsVOyoGt+rw5ndHMEpBggwKKRzgUoVY2EtxYpeXCRUgaqu0QypvwOXY970tfhqXVSvyzgxhJjdFiF2Lh5xyUh1h/RkGjH4L3EqVZ8i+oYi829VrnMpii0Hc9gRP2RHohD809/qfrpyxpn7uohbgykI8NxpEG5VHur6EZXLsrjKA9AvU2iHzg/MPXAGLjDEO6ncSjDkroUQvcwTZNdwZq+9tq+Jfv6CszxfiBZtpGtA== 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: List-Subscribe: List-Unsubscribe: The zram is useless when SWAP is disabled, make zram depends on SWAP. Signed-off-by: Kefeng Wang --- drivers/block/zram/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index 7b29cce60ab2..0cee425da0f5 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 config ZRAM tristate "Compressed RAM block device support" - depends on BLOCK && SYSFS && MMU + depends on SWAP && SYSFS depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 select ZSMALLOC help From patchwork Fri Feb 23 03:55:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13568565 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 BAF16C54E41 for ; Fri, 23 Feb 2024 04:05:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B13D6B0074; Thu, 22 Feb 2024 23:05:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 439306B0075; Thu, 22 Feb 2024 23:05:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2B0CE6B0078; Thu, 22 Feb 2024 23:05:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 1C2F36B0074 for ; Thu, 22 Feb 2024 23:05:10 -0500 (EST) Received: from smtpin06.hostedemail.com (unknown [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 57C97141036 for ; Fri, 23 Feb 2024 03:56:07 +0000 (UTC) X-FDA: 81821705574.06.AD1B5F7 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf27.hostedemail.com (Postfix) with ESMTP id 36B3F4000A for ; Fri, 23 Feb 2024 03:56:04 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708660565; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oVt8B+MSqNhE0QU2NQpeiymGFeWReFid756wqy7otAE=; b=Pu2vnpMuTJhfZcRjSfj9syzPreG215YzO5CyyHLEB5tZkDHr0TyhRbpnOgrntR72WDHjuO DZxm7wgQtjS1fRUIqh/A860TyKGvVkwJf9Ztxxo56aSCSKE3o0X4RWnWly3pY6CYdwcd4y KYcOOktjrx3GGtRnmALZ4RjFKqpysL0= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708660565; a=rsa-sha256; cv=none; b=bL2aEri1Coq+zlnBpOqQgtovdKy7eXGAwSHiywuRCv0doOo7O4seTotqkJ43rMEcZ74xiM 8oRYqtwd/EOUjZxjcvQ6cZvKAQzuXC+hwooLGo+rEUR69FZ1bQc8iZt6+bcgjqSPuqMxrc uk8Slcs7DmO+YK+Kbie130k6YQjNumc= Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TgwzJ1DHHz1FKW7; Fri, 23 Feb 2024 11:51:08 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id BB1EA140155; Fri, 23 Feb 2024 11:56:01 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 11:56:01 +0800 From: Kefeng Wang To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton CC: Chengming Zhou , Huacai Chen , Minchan Kim , Sergey Senozhatsky , , , Kefeng Wang Subject: [PATCH 3/5] zram: support deflate compressor Date: Fri, 23 Feb 2024 11:55:46 +0800 Message-ID: <20240223035548.2591882-4-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> References: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 36B3F4000A X-Stat-Signature: n1aoxb6eef74s8hwg9n5nyeikd6ci466 X-Rspam-User: X-HE-Tag: 1708660564-358356 X-HE-Meta: U2FsdGVkX18IZOhbCXmq0surFMSEN2LpitEOVVqsLgk4ZzGkdsSwldmWXZgzGH1n+BsU/z6zFVA6PBmL9h6YENmwkjmLgxEegdk6nq8vNbB9DxnF5JlYEVrkiQhPD2qbKHuZoIiCvq11b/473vEWPZF+qLZjc8yHOCJZ7DCerB4T73tvVb6QhKOpdiqrf9G+fKrn/wNR8Dp8WJRP0rup2E/SH3DzQF0Gk6sdPC+8YnwVI0sCU6BDlUa23ex56JipAAODWu0g/vdl0E9SIrhbwWeNijaIDKjQDX1QSvVkImt9wFqLAYg6Ssck+fMse2x1lRbZ0QC88tiUK/lefENrnV67INFdY5IowMQTTnGpCpuMCcdlBGO1EOtV8uoTeAW01n7v/hf1RWkmf2NALXekOTZ+jd/9U6EH6jNpAg/JM3HczzThPioyg0uZ8cdBLMogYSr9lWtlUwZlNjEclSbhOlJXCzKjuMpHcYhERsKNQ2ZAdtk+A+bJ6niUoduiF6YHenmybQduDAi4esSmk8sRycZFMDFduS+14Hil4OAo9IOJ0/PDJjZXuqB8ac+W88pObpVM30AjYKODaQSMpkccxAOA3KS6wxlL+bUOqgKXZYmmC54H27xy0VJeeb+EkujJIDko8LfuctS6zbj73q1HUWg3NNIQ7qaOOlVaTzKjqFYZ9vSgFyBMYXLcFyWaOm6c5s+AkFamcZpRvjdRS1Dw5PbO1xpyNlq6PhiUPT4YYWedYRxzxxiRYtXgMwlCgCcLDSTepx+RmYhUhHQ+mrtfDDalI3XmzHizJU0+16Z5OV19X99aaXkJ6XIzBq767sd4kz6TXj3dRBy0b2cLJOU23w== 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: List-Subscribe: List-Unsubscribe: Add deflate compressor support, also it is prepare for unifying the default compressor compressor for zram and zswap. Signed-off-by: Kefeng Wang --- drivers/block/zram/Kconfig | 7 ++++++- drivers/block/zram/zcomp.c | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index 0cee425da0f5..b007dda16430 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -2,7 +2,7 @@ config ZRAM tristate "Compressed RAM block device support" depends on SWAP && SYSFS - depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 + depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 || CRYPTO_DEFLATE select ZSMALLOC help Creates virtual block devices called /dev/zramX (X = 0, 1, ...). @@ -20,6 +20,10 @@ choice default ZRAM_DEF_COMP_LZORLE depends on ZRAM +config ZRAM_DEF_COMP_DEFLATE + bool "Deflate" + depends on CRYPTO_DEFLATE + config ZRAM_DEF_COMP_LZORLE bool "lzo-rle" depends on CRYPTO_LZO @@ -48,6 +52,7 @@ endchoice config ZRAM_DEF_COMP string + default "deflate" if ZRAM_DEF_COMP_DEFLATE default "lzo-rle" if ZRAM_DEF_COMP_LZORLE default "zstd" if ZRAM_DEF_COMP_ZSTD default "lz4" if ZRAM_DEF_COMP_LZ4 diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c index 8237b08c49d8..1f9a431f771e 100644 --- a/drivers/block/zram/zcomp.c +++ b/drivers/block/zram/zcomp.c @@ -16,6 +16,9 @@ #include "zcomp.h" static const char * const backends[] = { +#if IS_ENABLED(CONFIG_CRYPTO_DEFLATE) + "deflate", +#endif #if IS_ENABLED(CONFIG_CRYPTO_LZO) "lzo", "lzo-rle", From patchwork Fri Feb 23 03:55:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13568552 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 C69B8C48BC4 for ; Fri, 23 Feb 2024 03:56:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A255B6B007D; Thu, 22 Feb 2024 22:56:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D5D06B007E; Thu, 22 Feb 2024 22:56:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 876156B0080; Thu, 22 Feb 2024 22:56:09 -0500 (EST) 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 761016B007E for ; Thu, 22 Feb 2024 22:56:09 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4BAC01607BA for ; Fri, 23 Feb 2024 03:56:09 +0000 (UTC) X-FDA: 81821705658.03.E476756 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf22.hostedemail.com (Postfix) with ESMTP id 22F21C000C for ; Fri, 23 Feb 2024 03:56:05 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708660566; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=r8cwVLFqvdLeTMurwDEQ1BCVowOgXAvBjo6T7NBWjcU=; b=OEQfHt5LGSNvLhmnNScACN6KfXKnsw1XQoz5AgTtIR5kCgs51Gb0ike5CDLy74DocEh5Uu LPw5lCvmhCdhfXYq58coFvgymHBOFRGmwUnKDQyOOck5YSsoAWMUoP1CgGGNAZyBHMpcWZ 1Dt5agPLQ4mAiMQaKK9geIFiI7U7qfs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708660566; a=rsa-sha256; cv=none; b=Rnj3pTYQbP96msom0hi1Js/WdvJSB6d4AHNGA30M0b139o0NU004OcDEJ8tUqb1MFo0Rve vAUFA6r+8rkVDOKZ4qLYskQnqwZuBNdOrvZtWUL7C6SjHZWMNH8Wlh0kgn5qNCq97ePA1a U8d6Eujn9fEwoxxVQMPn4zbnyQKLpNI= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Tgx2S18Rwz1gyhf; Fri, 23 Feb 2024 11:53:52 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id 5AC04140155; Fri, 23 Feb 2024 11:56:02 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 11:56:01 +0800 From: Kefeng Wang To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton CC: Chengming Zhou , Huacai Chen , Minchan Kim , Sergey Senozhatsky , , , Kefeng Wang Subject: [PATCH 4/5] mm: zswap: default to lzo-rle instead of lzo Date: Fri, 23 Feb 2024 11:55:47 +0800 Message-ID: <20240223035548.2591882-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> References: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Queue-Id: 22F21C000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 8in6jsdjq1xgr5n8hafwpps4aj6aod3s X-HE-Tag: 1708660565-8170 X-HE-Meta: U2FsdGVkX19oqC0SUf1n3u6prPk3M64YlOyJHtQxbasghimqYYIO+gSsc0s8QE/JGowtkz6mfRp6Ayit46Lcy0AHa54DsQg/42plHgZNkmuS8WTA9fZFZ+u7MZZmsxHvb4NJ+LPsFfNcwmhnQ0RymzpLaPkWKXk/ms45LX5xSu6avApDv74c6NuGPjHNt6naNu149pXo0P0S9A1bl8DogKAXOPGryNjG5nWDlZ8ajKm1MIDiKA8PWhaCUkgJzlN/m0YTM5q4P/WNM+6RWZPGnOyxpHAOaqA8m6qcjtm4aEw5+kLZb51jXwCTuXYizF0162bF1eF5IKUOqvzPmf2L4WhGv5B0MuJ/j8vjeHoyKBd2jpC2WOacCHG+CTtM8moZEG6tNfVuUQXabSH9H3BS5+hYs5OzbhCiLWuN0oW30KPm1ry8x9gRLMWN1WLgh59EKSFBZM8yObbL/hFUZKUUmpmGEJoJTIzrs6UGjNWkg6TX0MaspVErd4CMKi66vB9PvbKO4YF4TxsecRfA3A4pbGybke6rXV1ruy8KjR8G5KIaDFnmmHfKUrS+ZQrvrmRsr01Hz9PyY4ZjEa6z47JbVuZF4ELAFOnz4uoZcg5/EccmmZlN0XSb/mlh1bMqX7+7ZVkGH8D5O+HAUr8Gs9QItIdtXpo0SlBCz6q6tplYnaprDV9ulmgy3WrBfgCYhWAe8x+T7UiDadCh+/5kAQhAqS6ASmqUXj2UaMMHAI8Lz2SGGNVsiOERd5LYFMbJJFo6dGH8Zw3bf7zvnRNesJTd1WsxY2i/4kTsWHH6aL9uysCMzgmgzt3Vz7rPKS7lvxwjC5+2+vSmqt0TN9eNwOpuels/NFJMXQtoM1DCAiv9ARPgMcIARXs85nMQmgFRNUlP7m54sn1ijetk9OL+G2OF/BcyUaFuqopbZTN+kErmtuoozXnSi4UJXJOtflyHXt9E21asow/Yr70suTL3iow StyiG3Fn 5ZmLEtepOkdBU0UNXwiPD3/oEXOkvJgt96CiqIaCWRN1qe9543riDPdlqQ+qNBLhOUBSx8xdDB81mSoYn9h23j2C3jtrH4JtxLAV/AOyKZJaCgwWRWI5vimycvJf5rYAUI3A3Z0JHVePMBGPtP/pQZR/i6H5yb3nwqRvK9FpYrQ6nzMl8lvc3B6hNVGbzrXLJ4KkWH0K4QGuxKn8= 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: List-Subscribe: List-Unsubscribe: Since lzo-rle performance is better than lzo, see commit ce82f19fd580 ("zram: default to lzo-rle instead of lzo"), converting zswap to use lze-rle too. Signed-off-by: Kefeng Wang --- mm/Kconfig | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mm/Kconfig b/mm/Kconfig index b1448aa81e15..f41a28b74efd 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -62,7 +62,7 @@ config ZSWAP_SHRINKER_DEFAULT_ON choice prompt "Default compressor" depends on ZSWAP - default ZSWAP_COMPRESSOR_DEFAULT_LZO + default ZSWAP_COMPRESSOR_DEFAULT_LZORLE help Selects the default compression algorithm for the compressed cache for swap pages. @@ -72,7 +72,7 @@ choice available at the following LWN page: https://lwn.net/Articles/751795/ - If in doubt, select 'LZO'. + If in doubt, select 'LZO-RLE'. The selection made here can be overridden by using the kernel command line 'zswap.compressor=' option. @@ -83,6 +83,12 @@ config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE help Use the Deflate algorithm as the default compression algorithm. +config ZSWAP_COMPRESSOR_DEFAULT_LZORLE + bool "LZO-RLE" + select CRYPTO_LZO + help + Use the LZO algorithm as the default compression algorithm. + config ZSWAP_COMPRESSOR_DEFAULT_LZO bool "LZO" select CRYPTO_LZO @@ -118,6 +124,7 @@ config ZSWAP_COMPRESSOR_DEFAULT string depends on ZSWAP default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE + default "lzo-rle" if ZSWAP_COMPRESSOR_DEFAULT_LZORLE default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO default "842" if ZSWAP_COMPRESSOR_DEFAULT_842 default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4 From patchwork Fri Feb 23 03:55:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13568564 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 23B7DC48BC4 for ; Fri, 23 Feb 2024 04:05:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 941BF6B0072; Thu, 22 Feb 2024 23:05:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F1D26B0074; Thu, 22 Feb 2024 23:05:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7B9436B0075; Thu, 22 Feb 2024 23:05:07 -0500 (EST) 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 667096B0072 for ; Thu, 22 Feb 2024 23:05:07 -0500 (EST) Received: from smtpin01.hostedemail.com (unknown [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6594E140DAA for ; Fri, 23 Feb 2024 03:56:08 +0000 (UTC) X-FDA: 81821705616.01.8F9D9F2 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf02.hostedemail.com (Postfix) with ESMTP id 197AA80016 for ; Fri, 23 Feb 2024 03:56:05 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708660566; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p22GJpYc1NhnEUg341CzWM1gnMePPvhmVikY/s+48ts=; b=bqGT9shv/CL3F8sVhp1g/56NoVDxROLVZtBFw0Kl31vyNYGG1O56fhK/aZrl5tVJZcOgWk 0xDYhewBZrSn0/UZza4tl89XInYrYUiWUerr58PFgdRzKYKBy9V681r4A1L7v7xpRw8XM3 sRVNVG1ADoRJHKSb6ltSVjF0Ydm6FUU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708660566; a=rsa-sha256; cv=none; b=uhVOaX6mmf/W+WuO0vnFDhad+GbaNroRRGZR/J+4oR/UoecQnBYI5vHQcP1mVSF+YX0lgY P2UW1hws5V1o/UH6b9IZAsN1vDhpBmPaJ1/Je7Rb0y5xiVLEvxeqKBJkmvjZ16Ggxg07UA tnQWdRKhjCI1gNLSp2G4u+nKgbpmPpw= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; spf=pass (imf02.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Tgx2j6Kc6zXh7x; Fri, 23 Feb 2024 11:54:05 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id E2B2B1400CA; Fri, 23 Feb 2024 11:56:02 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 23 Feb 2024 11:56:02 +0800 From: Kefeng Wang To: Johannes Weiner , Yosry Ahmed , Nhat Pham , Andrew Morton CC: Chengming Zhou , Huacai Chen , Minchan Kim , Sergey Senozhatsky , , , Kefeng Wang Subject: [PATCH 5/5] mm: unify default compressor algorithm for zswap and zram Date: Fri, 23 Feb 2024 11:55:48 +0800 Message-ID: <20240223035548.2591882-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> References: <20240223035548.2591882-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-Stat-Signature: imrhbpurgy3fgnohwajtkb3zxnzwgatr X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 197AA80016 X-Rspam-User: X-HE-Tag: 1708660565-439238 X-HE-Meta: U2FsdGVkX1/pzqYEy+iy1D08j2cDgvhlNNoo/z5C9Ul9AMeS+Sw4uwh8PzQMW/VH1OxV7fgqUmEVL2Ft/rlg9Dk0ZsXoZbklPtZkU158GPJOrdyhZLkn2MrfwON3bB+m4EJ+ygbOCYBJqvs31/dSKjrbZZmpWwtu47yaCMffrrMnlE1Y7hguJOJaY/1s6HoOqpmckJT3+Gn66d+DN5KJNEQvZmeDzmjYserSTeAKTX77lNIoxK0tP4Ar5zxIEQYjmgMpJQdo2y7XoqQc5PQOKe4PDEgu2PKBHQ93QU3dqFcTTlYvrpRSb+Z94gV++7jhJ4eUJXMbrmjd5PhJNaI2CEFTsFyCi9Xze1xmJ81M4dxdJES1ZG0k0paymBu7xZoMAfpI65J3WgkVhTqtVv72oehboOenRKOGpjApAgDaQo5VoJCqeHaN9bGeF87v6efnu4WPs6n3yTJgGieAzgcVCQjwPVrqDtn+fEP/q5oQf0+/WAMGMsI05cqPjdQDAPBAG7Li2Yy3pRgq9zWAf0mT/q3nafWE5ZE0eBSHYCFInDeYwmDlRzmedRunU3K/ALI8EnPugiBrWGkYZhUfqtPQbqLcGKDFJ/zxL3xyvQjkNLUIzwBFQZlxWVLsk/300ft7jW2zKuaV7ud5/gy86HmfnHeJhBlcvfhNbGhF2qpOt1sQC4oTKX+LaMoZE3e75TuxHD4rnCN9af/wv3qo6fV2h8Mm0U1dnfNwSXA6wj/a8b/2k0ap6d41FHz1MQdMxJsw0v7dNGTiNwqkW4dYzKNX6iiERyfZrxUdiUWtGL6gCZEynLx7Upbm5bOHTZPhYovid+zejjfGY8bN2oAZsrf1aVMQhNdQH/c6 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: List-Subscribe: List-Unsubscribe: Both zswap and zram could change compressor algorithm dynamically, it can be overridden at boot time by 'zswap.compressor=' for zswap, also there is a sysfs interface to change it, see /sys/block/zramX/comp_algorithm /sys/module/zswap/parameters/compressor So there is no need to maintain independence default compressor algorithm, unify the Kconfig to use lzo-rle as the default page compressor algorithm. Signed-off-by: Kefeng Wang --- Documentation/admin-guide/mm/zswap.rst | 2 +- arch/loongarch/configs/loongson3_defconfig | 2 +- drivers/block/zram/Kconfig | 47 +------- drivers/block/zram/zram_drv.c | 2 +- mm/Kconfig | 131 +++++++++++---------- mm/zswap.c | 8 +- 6 files changed, 74 insertions(+), 118 deletions(-) diff --git a/Documentation/admin-guide/mm/zswap.rst b/Documentation/admin-guide/mm/zswap.rst index b42132969e31..375366b9a642 100644 --- a/Documentation/admin-guide/mm/zswap.rst +++ b/Documentation/admin-guide/mm/zswap.rst @@ -90,7 +90,7 @@ controlled policy: * max_pool_percent - The maximum percentage of memory that the compressed pool can occupy. -The default compressor is selected in ``CONFIG_ZSWAP_COMPRESSOR_DEFAULT`` +The default compressor is selected in ``CONFIG_COMPRESSOR_DEFAULT`` Kconfig option, but it can be overridden at boot time by setting the ``compressor`` attribute, e.g. ``zswap.compressor=lzo``. It can also be changed at runtime using the sysfs "compressor" diff --git a/arch/loongarch/configs/loongson3_defconfig b/arch/loongarch/configs/loongson3_defconfig index f18c2ba871ef..dc718089a530 100644 --- a/arch/loongarch/configs/loongson3_defconfig +++ b/arch/loongarch/configs/loongson3_defconfig @@ -91,7 +91,7 @@ CONFIG_BFQ_GROUP_IOSCHED=y CONFIG_BINFMT_MISC=m CONFIG_ZPOOL=y CONFIG_ZSWAP=y -CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y +CONFIG_COMPRESSOR_DEFAULT_ZSTD=y CONFIG_ZBUD=y CONFIG_Z3FOLD=y CONFIG_ZSMALLOC=m diff --git a/drivers/block/zram/Kconfig b/drivers/block/zram/Kconfig index b007dda16430..26558159824e 100644 --- a/drivers/block/zram/Kconfig +++ b/drivers/block/zram/Kconfig @@ -2,7 +2,7 @@ config ZRAM tristate "Compressed RAM block device support" depends on SWAP && SYSFS - depends on CRYPTO_LZO || CRYPTO_ZSTD || CRYPTO_LZ4 || CRYPTO_LZ4HC || CRYPTO_842 || CRYPTO_DEFLATE + select CRYPTO select ZSMALLOC help Creates virtual block devices called /dev/zramX (X = 0, 1, ...). @@ -15,51 +15,6 @@ config ZRAM See Documentation/admin-guide/blockdev/zram.rst for more information. -choice - prompt "Default zram compressor" - default ZRAM_DEF_COMP_LZORLE - depends on ZRAM - -config ZRAM_DEF_COMP_DEFLATE - bool "Deflate" - depends on CRYPTO_DEFLATE - -config ZRAM_DEF_COMP_LZORLE - bool "lzo-rle" - depends on CRYPTO_LZO - -config ZRAM_DEF_COMP_ZSTD - bool "zstd" - depends on CRYPTO_ZSTD - -config ZRAM_DEF_COMP_LZ4 - bool "lz4" - depends on CRYPTO_LZ4 - -config ZRAM_DEF_COMP_LZO - bool "lzo" - depends on CRYPTO_LZO - -config ZRAM_DEF_COMP_LZ4HC - bool "lz4hc" - depends on CRYPTO_LZ4HC - -config ZRAM_DEF_COMP_842 - bool "842" - depends on CRYPTO_842 - -endchoice - -config ZRAM_DEF_COMP - string - default "deflate" if ZRAM_DEF_COMP_DEFLATE - default "lzo-rle" if ZRAM_DEF_COMP_LZORLE - default "zstd" if ZRAM_DEF_COMP_ZSTD - default "lz4" if ZRAM_DEF_COMP_LZ4 - default "lzo" if ZRAM_DEF_COMP_LZO - default "lz4hc" if ZRAM_DEF_COMP_LZ4HC - default "842" if ZRAM_DEF_COMP_842 - config ZRAM_WRITEBACK bool "Write back incompressible or idle page to backing device" depends on ZRAM diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index f0639df6cd18..664c4012ced4 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -41,7 +41,7 @@ static DEFINE_IDR(zram_index_idr); static DEFINE_MUTEX(zram_index_mutex); static int zram_major; -static const char *default_compressor = CONFIG_ZRAM_DEF_COMP; +static const char *default_compressor = CONFIG_COMPRESSOR_DEFAULT; /* Module params (documentation at end) */ static unsigned int num_devices = 1; diff --git a/mm/Kconfig b/mm/Kconfig index f41a28b74efd..9da2671e0b20 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -9,9 +9,6 @@ menu "Memory Management options" config ARCH_NO_SWAP bool -config ZPOOL - bool - menuconfig SWAP bool "Support for paging of anonymous memory (swap)" depends on MMU && BLOCK && !ARCH_NO_SWAP @@ -22,116 +19,118 @@ menuconfig SWAP used to provide more virtual memory than the actual RAM present in your computer. If unsure say Y. -config ZSWAP - bool "Compressed cache for swap pages" - depends on SWAP - select CRYPTO - select ZPOOL - help - A lightweight compressed cache for swap pages. It takes - pages that are in the process of being swapped out and attempts to - compress them into a dynamically allocated RAM-based memory pool. - This can result in a significant I/O reduction on swap device and, - in the case where decompressing from RAM is faster than swap device - reads, can also improve workload performance. - -config ZSWAP_DEFAULT_ON - bool "Enable the compressed cache for swap pages by default" - depends on ZSWAP - help - If selected, the compressed cache for swap pages will be enabled - at boot, otherwise it will be disabled. - - The selection made here can be overridden by using the kernel - command line 'zswap.enabled=' option. - -config ZSWAP_SHRINKER_DEFAULT_ON - bool "Shrink the zswap pool on memory pressure" - depends on ZSWAP - default n - help - If selected, the zswap shrinker will be enabled, and the pages - stored in the zswap pool will become available for reclaim (i.e - written back to the backing swap device) on memory pressure. - - This means that zswap writeback could happen even if the pool is - not yet full, or the cgroup zswap limit has not been reached, - reducing the chance that cold pages will reside in the zswap pool - and consume memory indefinitely. +if SWAP choice - prompt "Default compressor" - depends on ZSWAP - default ZSWAP_COMPRESSOR_DEFAULT_LZORLE + prompt "Default page compressor algorithm" + depends on ZSWAP || ZRAM + default COMPRESSOR_DEFAULT_LZORLE help - Selects the default compression algorithm for the compressed cache - for swap pages. + Selects the default compression algorithm for compressing pages. For an overview what kind of performance can be expected from a particular compression algorithm please refer to the benchmarks available at the following LWN page: https://lwn.net/Articles/751795/ - If in doubt, select 'LZO-RLE'. + If in doubt, select 'LZO-rle'. - The selection made here can be overridden by using the kernel - command line 'zswap.compressor=' option. - -config ZSWAP_COMPRESSOR_DEFAULT_DEFLATE +config COMPRESSOR_DEFAULT_DEFLATE bool "Deflate" select CRYPTO_DEFLATE help Use the Deflate algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_LZORLE +config COMPRESSOR_DEFAULT_LZORLE bool "LZO-RLE" select CRYPTO_LZO help Use the LZO algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_LZO +config COMPRESSOR_DEFAULT_LZO bool "LZO" select CRYPTO_LZO help Use the LZO algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_842 +config COMPRESSOR_DEFAULT_842 bool "842" select CRYPTO_842 help Use the 842 algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_LZ4 +config COMPRESSOR_DEFAULT_LZ4 bool "LZ4" select CRYPTO_LZ4 help Use the LZ4 algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_LZ4HC +config COMPRESSOR_DEFAULT_LZ4HC bool "LZ4HC" select CRYPTO_LZ4HC help Use the LZ4HC algorithm as the default compression algorithm. -config ZSWAP_COMPRESSOR_DEFAULT_ZSTD - bool "zstd" +config COMPRESSOR_DEFAULT_ZSTD + bool "ZSTD" select CRYPTO_ZSTD help Use the zstd algorithm as the default compression algorithm. + endchoice -config ZSWAP_COMPRESSOR_DEFAULT +config COMPRESSOR_DEFAULT string - depends on ZSWAP - default "deflate" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE - default "lzo-rle" if ZSWAP_COMPRESSOR_DEFAULT_LZORLE - default "lzo" if ZSWAP_COMPRESSOR_DEFAULT_LZO - default "842" if ZSWAP_COMPRESSOR_DEFAULT_842 - default "lz4" if ZSWAP_COMPRESSOR_DEFAULT_LZ4 - default "lz4hc" if ZSWAP_COMPRESSOR_DEFAULT_LZ4HC - default "zstd" if ZSWAP_COMPRESSOR_DEFAULT_ZSTD + depends on ZSWAP || ZRAM + default "deflate" if COMPRESSOR_DEFAULT_DEFLATE + default "lzo-rle" if COMPRESSOR_DEFAULT_LZORLE + default "lzo" if COMPRESSOR_DEFAULT_LZO + default "842" if COMPRESSOR_DEFAULT_842 + default "lz4" if COMPRESSOR_DEFAULT_LZ4 + default "lz4hc" if COMPRESSOR_DEFAULT_LZ4HC + default "zstd" if COMPRESSOR_DEFAULT_ZSTD default "" +config ZPOOL + bool + +config ZSWAP + bool "Compressed cache for swap pages" + depends on SWAP + select CRYPTO + select ZPOOL + help + A lightweight compressed cache for swap pages. It takes + pages that are in the process of being swapped out and attempts to + compress them into a dynamically allocated RAM-based memory pool. + This can result in a significant I/O reduction on swap device and, + in the case where decompressing from RAM is faster than swap device + reads, can also improve workload performance. + +config ZSWAP_DEFAULT_ON + bool "Enable the compressed cache for swap pages by default" + depends on ZSWAP + help + If selected, the compressed cache for swap pages will be enabled + at boot, otherwise it will be disabled. + + The selection made here can be overridden by using the kernel + command line 'zswap.enabled=' option. + +config ZSWAP_SHRINKER_DEFAULT_ON + bool "Shrink the zswap pool on memory pressure" + depends on ZSWAP + default n + help + If selected, the zswap shrinker will be enabled, and the pages + stored in the zswap pool will become available for reclaim (i.e + written back to the backing swap device) on memory pressure. + + This means that zswap writeback could happen even if the pool is + not yet full, or the cgroup zswap limit has not been reached, + reducing the chance that cold pages will reside in the zswap pool + and consume memory indefinitely. + choice prompt "Default allocator" depends on ZSWAP @@ -231,6 +230,8 @@ config ZSMALLOC_CHAIN_SIZE For more information, see zsmalloc documentation. +endif #SWAP + menu "Slab allocator options" config SLUB diff --git a/mm/zswap.c b/mm/zswap.c index 011e068eb355..907ae7797d98 100644 --- a/mm/zswap.c +++ b/mm/zswap.c @@ -96,7 +96,7 @@ static const struct kernel_param_ops zswap_enabled_param_ops = { module_param_cb(enabled, &zswap_enabled_param_ops, &zswap_enabled, 0644); /* Crypto compressor to use */ -static char *zswap_compressor = CONFIG_ZSWAP_COMPRESSOR_DEFAULT; +static char *zswap_compressor = CONFIG_COMPRESSOR_DEFAULT; static int zswap_compressor_param_set(const char *, const struct kernel_param *); static const struct kernel_param_ops zswap_compressor_param_ops = { @@ -386,11 +386,11 @@ static struct zswap_pool *__zswap_pool_create_fallback(void) has_comp = crypto_has_acomp(zswap_compressor, 0, 0); if (!has_comp && strcmp(zswap_compressor, - CONFIG_ZSWAP_COMPRESSOR_DEFAULT)) { + CONFIG_COMPRESSOR_DEFAULT)) { pr_err("compressor %s not available, using default %s\n", - zswap_compressor, CONFIG_ZSWAP_COMPRESSOR_DEFAULT); + zswap_compressor, CONFIG_COMPRESSOR_DEFAULT); param_free_charp(&zswap_compressor); - zswap_compressor = CONFIG_ZSWAP_COMPRESSOR_DEFAULT; + zswap_compressor = CONFIG_COMPRESSOR_DEFAULT; has_comp = crypto_has_acomp(zswap_compressor, 0, 0); } if (!has_comp) {