Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2704033rwb; Mon, 7 Nov 2022 17:06:38 -0800 (PST) X-Google-Smtp-Source: AMsMyM5ioPO1QNqMfDGuANlnB5PQKVHzaGcRQ2WDXmbTJCbSg4KhEaf/x+jOe4vZUPM2Wh5j0/01 X-Received: by 2002:a05:6a00:1ad0:b0:56d:5fdb:a29b with SMTP id f16-20020a056a001ad000b0056d5fdba29bmr45324932pfv.76.1667869598145; Mon, 07 Nov 2022 17:06:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667869598; cv=none; d=google.com; s=arc-20160816; b=AsrRjgydEW195icfO9a8y5QlVBDJFyFHJsUFX20iVE0tVn2jkwnKOMDW8yA2aFCK6U V0hIkCH/jzWxpS401Qf4G3X0zFyMY6zrpDpCciUwE8y4AccNMEXxfhwmYSGYnPXn4mMd rAUONcXdXpND+oIu7d6gflrWNeG1o9VSQ2wPbEuDItp6cYj3SHV1/xbQ2F1k0rsJmkQ4 eKNZEKfLBWOAU7NBYOK4GsF8+ESbebbnMjhbnybwwWUWxQY9BR/D3Vgu52CNQQ+74Dcg voMmH/gM8+CiReOoJAmFJuTf6vTlmpnRYNU8Jxos1vpOGUGLk9xAnVTfs+fS0lp9OjM/ +Mow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OM0r5u0WH+buQLtra84lMSPb6itvSvD0nc8HMAGCciQ=; b=wp932gA62i0Ry7kdSAxlmBIhx9QLnvB2r+iy87qJsW7jF36plMpOzBuFz7dbNgDBX+ xdJ2MWO+LtmEdWNCn2oju94KobCpbeU52O/ZaGULSlWnyns4YIujjVAh7JrGvkbr3UAw Th3oy1Miji6JgrJKdg+Du6wYg7Xa2BA4E9sfZeAZReti2S2oEeD2rYqgUmGd2HkevgJ6 wq+JoNS7xq2wadT1S9r9wa/6n9N+VAI66BA+epeZfSDS3To4U4aw9LU39g3tyi1EIpLH 3f1MNaz7TFdYjvar3+Vvx1X24nbz3mcLD2yE3BQwlidEbJZoy4bclzmqGNFAL96tMj10 4zaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TWamq7Ed; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a656897000000b0045ff2a2f56csi12614496pgt.546.2022.11.07.17.06.26; Mon, 07 Nov 2022 17:06:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TWamq7Ed; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232829AbiKHAkf (ORCPT + 92 others); Mon, 7 Nov 2022 19:40:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233140AbiKHAkX (ORCPT ); Mon, 7 Nov 2022 19:40:23 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEA202611D for ; Mon, 7 Nov 2022 16:40:20 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id h193so11990709pgc.10 for ; Mon, 07 Nov 2022 16:40:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=OM0r5u0WH+buQLtra84lMSPb6itvSvD0nc8HMAGCciQ=; b=TWamq7EdLsQok6vDR75JzTopHL0ZZBUv5VALE1B1puumyYTXPDCYlR+2gogdv6Rkm2 lugkVLtCa98IEJFVaurvYmUwXAJEojHJv3X8aHMGO4zLnat7Foc8egfpLkd71PLldEHK UyszcgqFuL2kpl+QHO1IrpIdrVIr8ZgPDe9kY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=OM0r5u0WH+buQLtra84lMSPb6itvSvD0nc8HMAGCciQ=; b=v+P4/R94NLF+aMba6l5mbcJFdhLPVFQPH+CWGYAGEHljutvThCyb60kDfSlimuNnax BH7RzJHQW9uhPMec5Qkr2Rrmf70U5lxAJRbeYfauDvaev6qQIsHpwx0Jw/01HoyM94Ti nQvYOQOszCdyNcXv8S52pAb2vRa0iPQxIdVKUL2/rDAsvYlAMYRX2dTaGaAdV46BSktr Rd6ACWQ1p6v8HSQ/am0PyIPi9a4hOTqUwx2UaSCIlI8IjgnFPvZ+Jx23kwYpQP5Vdjh8 A5nsUNLaBhNVL6DzcdbWjegmZy/og7auWEWf8F8uMuiW5lZAbBynIfHPGht4gdMk47gL rKSQ== X-Gm-Message-State: ACrzQf1hYDtvzDzn1zRyOJMTKLiDhSL07WgTj23nKifOxVRkYMCe6nD/ y61oBgzJQuxxeRJe59VKd8ECnlQz6YXSkQ== X-Received: by 2002:a63:8bc3:0:b0:46f:fa99:7d76 with SMTP id j186-20020a638bc3000000b0046ffa997d76mr30252805pge.134.1667868020231; Mon, 07 Nov 2022 16:40:20 -0800 (PST) Received: from google.com ([240f:75:7537:3187:8d5d:1342:1172:9487]) by smtp.gmail.com with ESMTPSA id a24-20020aa794b8000000b0056cd54ac8a0sm5055970pfl.197.2022.11.07.16.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 16:40:19 -0800 (PST) Date: Tue, 8 Nov 2022 09:40:15 +0900 From: Sergey Senozhatsky To: Minchan Kim Cc: Sergey Senozhatsky , Andrew Morton , Nitin Gupta , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv4 2/9] zram: Add recompression algorithm sysfs knob Message-ID: References: <20221018045533.2396670-3-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/11/07 11:08), Minchan Kim wrote: [..] > I am thinking like this: > > * Without recomp_algo setup, user can do whatever they want on the fly > > > echo "type=idle threshold=3000 algo=zstd" > recompress > > Later they could do > > echo "type=idle threshold=3000 algo=deflate" > recompress By "without recomp_algo setup" you mean that user doesn't configure anything before `echo XG > zramX/disksize`? Currently algorithm and recomp algorithm need to be selected at the same time - before zram device is initialised, because we use the same code and same approaches: we need to have zcomp back-ends in per-CPU data in zram read/write/recompress. Creating per-CPU zcomps on the fly is probably going to be a little bit intrusive to zram. What I currently have is as follows. A copy paste from my test script: - init device echo "algo=lz4 priority=1" > /sys/block/zram0/recomp_algorithm echo "algo=zstd priority=2" > /sys/block/zram0/recomp_algorithm echo "algo=deflate priority=3" > /sys/block/zram0/recomp_algorithm echo 5G > /sys/block/zram0/disksize Various recompression use cases: - recompress huge pages using all secondary algos in order of priority echo "type=huge" > /sys/block/zram0/recompress - recompress huge pages using zstd only echo "type=huge algo=zstd" > /sys/block/zram0/recompress - recompress all pages using lz4 echo "algo=lz4" > /sys/block/zram0/recompress - recompress idle pages, use all algos in priority order, with threshold echo "type=idle threshold=3000" > /sys/block/zram0/recompress - recompress idle pages, using zstd only, with threshold echo "algo=zstd type=idle threshold=2000" > /sys/block/zram0/recompress