Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1854482rwi; Thu, 3 Nov 2022 09:47:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gL+9gcCA0Brf9f5zUkHcWiN6Ud+3KKMxySqPTyBDFw0v43VuULjLzKXLtSkdhc8UBq8Py X-Received: by 2002:a17:907:782:b0:740:7120:c6e7 with SMTP id xd2-20020a170907078200b007407120c6e7mr29650653ejb.313.1667494039953; Thu, 03 Nov 2022 09:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667494039; cv=none; d=google.com; s=arc-20160816; b=RKmuj5lyaCDU7KPald+y8RI/22Uh4fdpuBEfw93G5RdE5oiroGJC6a3CFi5UykD7sR 23F4JbkIJZSDbEHwKR+oNVFglfcaBbYRWA+TH3u6Wh76sAQA+JHNEz9Mlhv97oPj7+FY DSGy6zgvSrH2Z6KYdcdXECtHiy7+UXpj+zd81W6ZdRC2Qo9r1ZmZW6lC6jEeXBm5y2JQ yeBZmiTYclnIGj8PgeFmJ7c/LwXp2YURTYWrzE+1wnxMWZxcUSKiTpeqyvSQKGiiguSF J3IgJMjjuWW/6AbiI/shJhs4ecH4ADjf/aJCde9Io+aJ1+IbjEwXIzfFCWZ6KcDDZjmv VoxQ== 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:sender:dkim-signature; bh=wvuEj0nbKN1+WA2P0qBtkJX32FgYd3x0JlBhjNkSxDI=; b=IQCTl6yGUVTWWpUOnzz1ATV9wGBqDwbzTO5id5XO6rJSuWtXBwxA8X0d6lU/HEz4xS h2aBwuJlUS/BCpYLgsnBkmAOfrGm9FbgQwg9Y7rr1WAO3BqbGjiRdNSp/Z7zsqxLjHTH G/Gvy3I9kgojeo2xMmjb3DydBo020De1aIf/Mv5S2QnK8ilXZO9IBVemnGJJfXpB9FBs XFWaYrCxlnqZSFDvjcCF2haGPOYI6HwqqL6SWC52+CPODISD19dkDYB4O6ww53YCMWqs 1fED4HWKDMb6VFKKpcPqZQPOpnOWpEHhbGKUUtS6ad++cM4MHedixhFaayFjmX2O+mBy LWnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="e0JNY95/"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn13-20020a1709070d0d00b0078c4a772ea7si182015ejc.11.2022.11.03.09.46.53; Thu, 03 Nov 2022 09:47:19 -0700 (PDT) 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=@gmail.com header.s=20210112 header.b="e0JNY95/"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232360AbiKCQii (ORCPT + 97 others); Thu, 3 Nov 2022 12:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232342AbiKCQiS (ORCPT ); Thu, 3 Nov 2022 12:38:18 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DD701DA5E for ; Thu, 3 Nov 2022 09:35:06 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id k5so2166422pjo.5 for ; Thu, 03 Nov 2022 09:35:06 -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=E2kwc7P+NCdj93/idW2jwXe+lPViTeK1TVr41O2dWmNgwFln3M+xTkCQLkwLg1r9ny ZtgGnsALu3G2weZFqUUBKhmwocmCamkb7NLrChtMg9GCSuGUzKLXWNk43+tXzgO/Y1x1 XY8+p7m05APNf3oNFVj0cjc6gl92ay6hIh7ZL0e/XSPJbcYjX/gK/bjTpI3J9VPjCtuS p+I3qozTPqwhOUO0eUoQU2UktC39LjL15UIUUBcx7401ugvOGvzN3Q4LJkoNw6lbNZUT bLoq1Ne6teEQjM4MnWmj0DIF9TMBg9rqwSvd2Iiu2AoPylsZ1pRBbOy5uzAVcPAw50+U AeIw== X-Gm-Message-State: ACrzQf0zdtVlM02IWnl+brt3HGgrjFDtlyqOPmJ0NvdNj+aNy0CTJCmL EfdRbuKD7pu+PxGHgS4xkBo= 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) Sender: Minchan Kim 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: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=no 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 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.