From mboxrd@z Thu Jan 1 00:00:00 1970 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 04384C433FE for ; Thu, 3 Nov 2022 16:34:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 911276B0072; Thu, 3 Nov 2022 12:34:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C1D46B0073; Thu, 3 Nov 2022 12:34:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 789466B0074; Thu, 3 Nov 2022 12:34:55 -0400 (EDT) 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 659FC6B0072 for ; Thu, 3 Nov 2022 12:34:55 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 45421A1162 for ; Thu, 3 Nov 2022 16:34:55 +0000 (UTC) X-FDA: 80092680150.24.0B4F07A Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by imf13.hostedemail.com (Postfix) with ESMTP id C201420009 for ; Thu, 3 Nov 2022 16:34:54 +0000 (UTC) Received: by mail-pj1-f49.google.com with SMTP id m6-20020a17090a5a4600b00212f8dffec9so2360928pji.0 for ; Thu, 03 Nov 2022 09:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=wvuEj0nbKN1+WA2P0qBtkJX32FgYd3x0JlBhjNkSxDI=; b=e0JNY95/P9YXExz44lREzXETuw5bQj+rAMvnomUpDTYm5faF6isz+O8k0pKlZSRLON 8XX/t+9EN5HxEwfpXJAYAL1GB4Ch6sazJviPoV2KfY346pHLsEHvkmwJb7BbGEIFqhfl rMpsmKiOJJj+/aO+sBuaISY5QWSt1EewW1bILWwK4Qxa3kewR8Xo3u4AF6YM8ht6+/w+ 7oYOciygOiLVqSgFJgdMZ26NpdmZv0pI7R3HFS8aaojntM+0dUxDpXJIDXX8A//N6MLz rEtfJ+NtARv3tKAw24PYiztagGAfJtAhQGoh2yssYNwERJ29rl2VpZpAEifrhVpRPUbx M7EA== 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:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wvuEj0nbKN1+WA2P0qBtkJX32FgYd3x0JlBhjNkSxDI=; b=MO3o+Jdt7+8NIRoeTA46xxhG1B7xmIVIIDB0Fh7/cisv6peyC71rMCmTdLi5Or32F4 BOTkAOA3dh0rBIW/2D/8+lCljbiApNq2603LHpOz0NFdcZ1WNtGzf59jC3CMCiiLU9mB 9YvggMoFxDXU3ODZB6qWPfKLMWC2eFV5Kap0AmrFDqDcKeJby6777ZUU7U1KZ18Pue/D AWFmuY8y81o7/1Wgx1iMeOgwqx/izPXgFNLid4Bu3hsqISFDxfgJ6GYB28Vx9QkVxLy1 zfLppcZZb6avjwtdxTXSX1nGjSTTSTQuqHdKkYDopkLHXHqrIgN5iOiAO58c5bySygHJ vYlA== X-Gm-Message-State: ACrzQf1g/zUf0DcOJ2MiEIsjlysImlEmA41AzbCwgas7E4NSLG9o6hti pE8CSrmIdqcIPlz/JTxlLC8cE40VRso= X-Google-Smtp-Source: AMsMyM4APAfVVOzLpQYDdS762oMWU50uqALnqqYmM5oioHJ1Vmqew6d/hYzzZuJ9sewUxtO4kB02sA== X-Received: by 2002:a17:90b:4a09:b0:213:9911:5f07 with SMTP id kk9-20020a17090b4a0900b0021399115f07mr32763685pjb.160.1667493293720; Thu, 03 Nov 2022 09:34:53 -0700 (PDT) Received: from google.com ([2620:15c:211:201:3d65:7dc2:c62a:5d98]) by smtp.gmail.com with ESMTPSA id h16-20020aa796d0000000b0056c2e497b02sm964876pfq.173.2022.11.03.09.34.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 09:34:53 -0700 (PDT) Date: Thu, 3 Nov 2022 09:34:51 -0700 From: Minchan Kim To: Sergey Senozhatsky Cc: 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-1-senozhatsky@chromium.org> <20221018045533.2396670-3-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667493294; a=rsa-sha256; cv=none; b=IEYH6VAG3OMcC/132MtbxTET9G2K/5upCFS7B3wKQxGuTzD8uaPC7GIgzChAhyxwE2SgoZ mkyttSsNEoi/7QBIRLtVi/4Wy8KSsHYTfntOrPtg9pyXwvywGELzn2K3JYuhng92RDWjDi hPgzz5MNAszh+cSRF4AxYvm9cO3hsUk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="e0JNY95/"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf13.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667493294; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wvuEj0nbKN1+WA2P0qBtkJX32FgYd3x0JlBhjNkSxDI=; b=bow9aIqvnS+A9H9H0qsugF5SixM5CKcaCFiWDfEiawbxsaBssjNLdjTF3vL9jQt3QUmeIs OTfJYgR7mOkvKyjJ92Yx4H+UuuS0/N1b5AjLKrsWa7PYaNyjoWVcZYfFt+iYIeEIJC+nNk t7ak9nI+OTwld+HLvPiFCV2v7CEEN3g= X-Stat-Signature: w1fb4sdkfab9ra3367pozd4juu1ruwkw X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C201420009 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="e0JNY95/"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf13.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.49 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-HE-Tag: 1667493294-714175 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: On Thu, Nov 03, 2022 at 12:05:06PM +0900, Sergey Senozhatsky wrote: < snip > > > Just open question(I might be too paranoid?) > > > > I am thinking someone want to add third comp algorithm in future > > to balance decompression and memory efficiency. > > > > If it's not too crazy idea, let's think about the interface. > > Maybe, could we make the recomp knobs works like list? > > > > # A primary comp > > echo "A" > /zram/comp_algo > > > > # Multiple secondary comps > > echo "B threshold" > /zram/add_recomp_algo > > echo "C threshold" > /zram/add_recomp_algo > > echo "D threshold" > /zram/add_recomp_algo > > What is the threshold here? My design approach is that ZRAM doesn't do As your term, watermark but yeah, priority you suggested would be good for me. > recompression on its own, so no magic is happening automatically. It's > the user-space that triggers recompression for selected pages when > user-space thinks it's time to. This allows us to have various flexible > policies and consider things that ZRAM is not even aware of: battery level, > free memory, CPU load average, etc. E.g. no recompression when all CPUs > are busy rendering video game, or when we are draining battery too fast, > etc. > > > "cat /zram/recomp_algo" shows the list > > > > echo "C" > /zram/remove_recomp_algo > > will remove the C algorithm in stack. > > What is the use case for removal of a secondary algorithm? Without the interface, How can we modify the selection if admin want to change the order of second algorithms? > > > My point is that we don't need to implement it atm but makes the > > interface to open the possibility for future extension. > > > > What do you think? > > So, as far as I understand, we don't have reason to add remove_recomp_algo > right now. And existing recomp_algo does not enforce any particular format, > it can be extended. Right now we accept "$name" but can do something like > "$name:$priority". The only thing that we probably need to do is rename > recomp_algo to either add_recomp_algo or register_recomp_algo? Yeah, I like the name and priority format. Only question is how we could support algorithm selection change under considering multiple secondary algorithms.