From patchwork Mon Sep 5 08:15:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 12965746 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 14156ECAAD5 for ; Mon, 5 Sep 2022 08:16:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F768801B9; Mon, 5 Sep 2022 04:16:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 58037801B3; Mon, 5 Sep 2022 04:16:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F990801B9; Mon, 5 Sep 2022 04:16:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2B329801B3 for ; Mon, 5 Sep 2022 04:16:04 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0DC0AAB0B for ; Mon, 5 Sep 2022 08:16:03 +0000 (UTC) X-FDA: 79877323806.21.75D1784 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf02.hostedemail.com (Postfix) with ESMTP id 8282A80073 for ; Mon, 5 Sep 2022 08:16:03 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id t3so2756730ply.2 for ; Mon, 05 Sep 2022 01:16:03 -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=RUYURRnuSvq4NT9sTSJkuNMIMv1250uZHq66s+BflcY=; b=G9CyBAGR0bkiQTupvpx/COu7sAEq+idFHL56EGyRChnlFH9hO3qv0An9jOfeYHmwC9 RYUiKs3MRQxpEjyhyD8AOosQpaW0SJ2YGBr9lw8m5AE6LAHwHcubtym968taJV2YOFsi sqdhNS3Xp6KljIYPCCzTQhtbmF8nuzhwEGA7Q= 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=RUYURRnuSvq4NT9sTSJkuNMIMv1250uZHq66s+BflcY=; b=RjS6Qkxh456Z4u8nvorUiK7BMEf0PfAezQepgWqK2qJQQj7IiM2CGxZXYtrhHF3s+/ UJfvhu3P/cwckSf+9vSDJv0SWJrfAtY6NxhfOmmdZNRq0Aiayo20A0+p/m0P/GyRZKzU SBIsYR/RipWh+l8S8tygLYnnLyLIvroX1sYqNsXpXQz8wQbW3Nrt3ijNRuhPGInYMnZs 4d0ivK9oK+iGXdNAKmGqMmA6YVcXOREdB6jzbG+y/wskhXjI2QdBpo3+ND+1HTh0z/X6 PYzAA70qHYqoLz/C/WpObfCFoIfhiFEI9C8pq84sxRbDlbs8CX4D9/T/bSKAnWVwhGBJ rPLQ== X-Gm-Message-State: ACgBeo2fMu1Mk7KM0NT6uiWrPuLPRSijys4eow9PxV+PFZQOeGQ8DpDe +orJdSRDSfzJWQagW+w2nzMmkQ== X-Google-Smtp-Source: AA6agR4KuIMlqoNshNHLtk8PkCAoUWto2+pwOemnkdYiczYkaWFTB+6fYFnJFqawp1GEJA7eAWbNPA== X-Received: by 2002:a17:902:b098:b0:176:86b4:68d4 with SMTP id p24-20020a170902b09800b0017686b468d4mr9821254plr.161.1662365762385; Mon, 05 Sep 2022 01:16:02 -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.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 01:16:01 -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:15:42 +0900 Message-Id: <20220905081552.2740917-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662365763; a=rsa-sha256; cv=none; b=yy8GISrm9JhOmaNhoHer/KKvIhJ3cOeYij5S7I6Kl/ywL2jKkN2GnWhqR7U8xy1rbFHDOs Q/nHle9/yqKm7dTUEeKbAR5I5ku/yQz4wMGiqq8XcXJ62h5Gk5aSJh/TqJmPaXp0NtAb9/ DXz109UXHXlONKFr/nw7TOOgVWAK16c= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G9CyBAGR; spf=pass (imf02.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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662365763; 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=RUYURRnuSvq4NT9sTSJkuNMIMv1250uZHq66s+BflcY=; b=0lU6DXlbo5rdJAiyj7M7R6j3Ow1q6jnudmPYVtDwAzr/1qAupvQL4tyOLmwYfPWmuAlAWc bQ/4DYoqND/qeYwdjtczr/kigmqebNtJ1zWso2IlVR2ygx4YfXhTQ5+LvTTFKNUM/wVEWH sZru6qf8wEOjCPP2KMcNId9tdgsXap0= Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=G9CyBAGR; spf=pass (imf02.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-Rspam-User: X-Rspamd-Server: rspam12 X-Stat-Signature: aa1wwwpdxqtw1nibkixmkysqrtcs7wdh X-Rspamd-Queue-Id: 8282A80073 X-HE-Tag: 1662365763-907960 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(-)