From patchwork Mon Sep 5 08:23:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12965767 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 895D6ECAAD5 for ; Mon, 5 Sep 2022 08:23:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279BB801B3; Mon, 5 Sep 2022 04:23:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 226D38D0050; Mon, 5 Sep 2022 04:23:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 115B0801B3; Mon, 5 Sep 2022 04:23:31 -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 023AB8D0050 for ; Mon, 5 Sep 2022 04:23:30 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CED57AB0CD for ; Mon, 5 Sep 2022 08:23:30 +0000 (UTC) X-FDA: 79877342580.12.7DC6584 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) by imf20.hostedemail.com (Postfix) with ESMTP id 873C81C0080 for ; Mon, 5 Sep 2022 08:23:30 +0000 (UTC) Received: by mail-pg1-f176.google.com with SMTP id x80so7564434pgx.0 for ; Mon, 05 Sep 2022 01:23:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=nUCnbO2absdQrtuWPadW3KdoRD67th+lOoHZlFDSG0w=; b=aWNl+LDCwjT4MllzwLAjGBRtqoB6fZkiMJQ/HvqlnAEhfYabxJ9+lZ3yEqT0LN2G1W 0VtCs/zaBeO2fygStYLMjLOYtPZs26i6XVMRpIWsn/R+EvG5WqNAoew5+eItYMxiv5Hf qUJbChc0iv9noh/D7033VQ/eBI9wB/zGzGylA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=nUCnbO2absdQrtuWPadW3KdoRD67th+lOoHZlFDSG0w=; b=QSvrH3NQSjfMdKhBXFduQfUwp6d4wWtLvuiAMg4eU/TGZh45OrHSQKCxryGYQz+mXW /7kPcnZgP3/Om+g/O1j66l/EGzkaMtkLzV5Ahkzq8eHc1dD5mBERUavrmq3IMW7zMNjF SJwXrBLb34M3dStJdpnPXBCNB964z07iJiDg2AAM5YQBSFcv/var6PlyLl4gfYwtvjHK ZxBhZZr5lOcbJq4qvKWbdaVpXoTKZqAZyCX8Y8AyU73+TaGBam4pCgCPwoGD73bmwigf 7ztUSf3LuQ3MXwDRuV3QUX/MxxNAiU3cqNyINJSoBSBMMJQgCaNr/64ZjEvcXm2Ssh+Y zPHA== X-Gm-Message-State: ACgBeo0gfbzKD/9k/7aFaQCDtpdP9xEez3gVoGSC/Uu+9M2JGlEghVAn nI+MYuUR6lalfpD8+bXxS9iHvw== X-Google-Smtp-Source: AA6agR4nHkQjA2Q96hRzWMzbFe/tamyeNKFnpMQI/uo6RzB7V4qAkIgp41HXHw9pfG97iYm1ecnLCg== X-Received: by 2002:a63:4503:0:b0:430:48ac:6046 with SMTP id s3-20020a634503000000b0043048ac6046mr20266544pga.74.1662366209571; Mon, 05 Sep 2022 01:23:29 -0700 (PDT) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:71e2:8444:42d9:4bb0]) by smtp.gmail.com with ESMTPSA id p14-20020a170902e74e00b001641b2d61d4sm6807093plf.30.2022.09.05.01.23.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 01:23:28 -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 RFC 0/7] zram: Support multiple compression streams Date: Mon, 5 Sep 2022 17:23:16 +0900 Message-Id: <20220905082323.2742399-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662366210; 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:references:dkim-signature; bh=nUCnbO2absdQrtuWPadW3KdoRD67th+lOoHZlFDSG0w=; b=SFMWXQLRPVu9jAdhVktEnjl+pbXM3uUqzC14X/Q6h8AuNOz8t1OpdbM3dt0WL+4v2adVAb vrxPWat3472rCYIDOJtUut4pzjkNMXOIvAovGXipx0JeNCBeWe4b76yON1f+Dbb6kdR30R nhB82xHNG3Dr3R/9i9wlKm41GkWnLaE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aWNl+LDC; spf=pass (imf20.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.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=1662366210; a=rsa-sha256; cv=none; b=6d8WRvTSNCt4fhwPm2ZthGAZhFoEVbvQjPwLC+WrJVhKEdp38fGHrHnMYtoe8FmSFgk5Xr 66xDXMwd9UYhlXRrgbonGOVM1q1ga8JxQ3MJteRvq9Km46igT0hEI9HwSNG0fWxlvF7Y73 003N2G9C2sVkEI9wBMug6kq+7NSV690= X-Rspam-User: X-Stat-Signature: aa1wwwpdxqtw1nibkixmkysqrtcs7wdh X-Rspamd-Queue-Id: 873C81C0080 Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=aWNl+LDC; spf=pass (imf20.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.176 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org X-Rspamd-Server: rspam04 X-HE-Tag: 1662366210-14829 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: Hello, RFC series that adds support for multiple (per-CPU) compression streams (at point only 2). The main idea is that different compression algorithms have different characteristics and zram may benefit when it uses a combination of algorithms: a default algorithm that is faster but have lower compression rate and a secondary algorithm that can use higher compression rate at a price of slower compression/decompression. There are several use-case for this functionality: - huge pages re-compression: zstd or defalte can successfully compress huge pages (~50% of huge pages on my synthetic ChromeOS tests), IOW pages that lzo was not able to compress. - idle pages re-compression: idle/cold pages sit in the memory and we may reduce zsmalloc memory usage if we recompress those idle pages. User-space has a number of ways to control the behavior and impact of zram recompression: what type of pages should be recompressed, size watermarks, etc. Please refer to documentation patch. Sergey Senozhatsky (7): zram: Preparation for multi-zcomp support zram: Add recompression algorithm sysfs knob zram: Factor out WB and non-WB zram read functions zram: Introduce recompress sysfs knob documentation: Add recompression documentation zram: Add recompression algorithm choice to Kconfig zram: Add recompress flag to read_block_state() Documentation/admin-guide/blockdev/zram.rst | 64 ++- drivers/block/zram/Kconfig | 51 +++ drivers/block/zram/zcomp.c | 6 +- drivers/block/zram/zcomp.h | 2 +- drivers/block/zram/zram_drv.c | 432 +++++++++++++++++--- drivers/block/zram/zram_drv.h | 15 +- 6 files changed, 504 insertions(+), 66 deletions(-)