Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1299565rwl; Fri, 4 Nov 2022 12:11:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM79WgUkyKToVH9ScQpzmQlNdF76ct4DxVT6+8KFFuXn2EBbSzqNN2Z50Ejz+ZP+RcTJO+bA X-Received: by 2002:a63:40c4:0:b0:470:18d5:e914 with SMTP id n187-20020a6340c4000000b0047018d5e914mr10585731pga.58.1667589064365; Fri, 04 Nov 2022 12:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667589064; cv=none; d=google.com; s=arc-20160816; b=Osy20VDQwRdpf88Q27bDKT8rjY9qFXtCoi+QAIi/19hcZT9hBpejrypzfDSoFQR3zx Od5F1FRtTPfLk6tNOjeG5PjVyb4MaFFNanWwfsGFpEWhK1tk/il62dZ1hT6H7qz+mgPX y3ncLe0XoELYU2YPqp/SC8EyrxfLJ1k/O3OUiISEQUDPHHiRabqbN4S88vEWGsSQnnmh N15hFvaFXz8d9GiARPFhPcjsg4xaF6/p9vHdQXN8i70PVQmp1y20Bb5PUil617sLe1ps 3X1hKzIicg4LpeATD7G/wUBbj4BmKn5iN6UU1P9NWCO3f2L77tWG16vpGHOt1Zm+D1b5 K2FA== 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=Ym4tTa7HJpk2L/lI6OldtK0o0jadOpOF8+GMFA83qbA=; b=b8/tUTg0RL9Oq6EzoM99CgGujVSwogBGfHYfJWDTSmx/iK9MFl1bX7Yp+TUMzFy5Zr x8abjbSZickUDCB6GTBux+51TfefIsotknF/FyRccoMm10TGM0wHoZpRWaIgDiHF350m rRd30VqyZKnwwRvvyjmM/KvHTMcggtQbJQ/pkfZxZsKda3tALM7tIjbop4Xu7TY+8qED PF9m49lkeKlTDZGPyLAvVlPevIWLrRFkuwtCjAty9ZHaqyJlvxQWAZkQNWOOlvjKbRyc 12LmaGizUI90DbEyA73CeTx85Z2MFdibeA7vKGSuHFEPoJEpbwzgohzy8NDYfBBNhGnb guyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=RJ6QR4Ig; 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 m14-20020a63ed4e000000b0046f584c7627si293724pgk.362.2022.11.04.12.10.51; Fri, 04 Nov 2022 12:11:04 -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=RJ6QR4Ig; 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 S231977AbiKDRop (ORCPT + 96 others); Fri, 4 Nov 2022 13:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231971AbiKDRoX (ORCPT ); Fri, 4 Nov 2022 13:44:23 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95F742F41 for ; Fri, 4 Nov 2022 10:43:33 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id i3so5103242pfc.11 for ; Fri, 04 Nov 2022 10:43:33 -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=Ym4tTa7HJpk2L/lI6OldtK0o0jadOpOF8+GMFA83qbA=; b=RJ6QR4IglVEuR0hYC7lz/fpX6wgtAH99brFcbLXCLtVZxIkpLB7HbT8rXXyyHHZQ2q QzEJU9GX9LXDgR2m2KLJXrj7lJPYICrlC5QpJmzRxiVl1W2BeE7lle/rUAqcXDOEh0ra iU92VKcrwO4vjavCX8Y24xRaJe/tQXe2+qnz3+uG6JJakC+TP+qWox485vUll7I+62X5 tqK6ID6DQP0aYieT5qrKd1DXfL1ABBya6A6JJf4Wb4FM/tD2fGm7kr+5mydalyqwxfaz JQ4LlEO92wjSrYaHKpENjtykxsR1cosO0LGjA4XKCobThCjtf5kEMbVNlZsg7nL5H8xS ixyg== 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=Ym4tTa7HJpk2L/lI6OldtK0o0jadOpOF8+GMFA83qbA=; b=PIUrAbeqF72z07hgtmUZ70CLQwdUmMwR8jTeXGzp3+nWeKA8EfE2PP/qxgtDg5xIBd hPjVvrD2dC8XPLmX+Pxeg2mcYl/XFzlVav5gRupQt5Eg1CAJrqxuTR3q+lHaTl627001 C5OolDNn6se7RN6GClxldQHLj0GOVLu5Ve4+T3yq7X4XlgbWoRKBP4RbQxG+YswXLQCs VrsLopqJLPlX+Kg0zXbai9uRg2S6mDv8xOSGu3CRNIfChDyfwF1XdiLSwtv2ln4eUQUT 7vPAq0jpraAA5d+i6+JzPn0VDl1wcqzLxQLmgUrkl0DBVAnu9hmQTcM4abmG8BDDQl5y s2BA== X-Gm-Message-State: ACrzQf2ioBZcvzlpFnHwbYmqCElpO1glcih4zz0vmpC09q5mwtYkNKVe YsWH0Nc3WBhOtL6PufoJ9OI= X-Received: by 2002:a63:1d0f:0:b0:46e:e211:5433 with SMTP id d15-20020a631d0f000000b0046ee2115433mr31224631pgd.324.1667583813256; Fri, 04 Nov 2022 10:43:33 -0700 (PDT) Received: from google.com ([2620:15c:211:201:755f:cdcb:1bd8:5ad8]) by smtp.gmail.com with ESMTPSA id x1-20020a633101000000b00464858cf6b0sm13848pgx.54.2022.11.04.10.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 10:43:32 -0700 (PDT) Sender: Minchan Kim Date: Fri, 4 Nov 2022 10:43:30 -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 Fri, Nov 04, 2022 at 01:53:11PM +0900, Sergey Senozhatsky wrote: > On (22/11/04 12:18), Sergey Senozhatsky wrote: > > On (22/11/03 09:34), Minchan Kim wrote: > > > Yeah, I like the name and priority format. > > > > > > Only question is how we could support algorithm selection change > > > under considering multiple secondary algorithms. > > > > So what I was thinking about, and I'm still in the mental model that > > re-compression is a user-space event, just like writeback, extension > > of recompress sysfs knob with "algo_index" (or something similar) which > > will mirror algorithm priority. > > > > Example: > > > > Configure 2 alternative algos, with priority 1 and 2 > > > > echo "name=lz4 priority=1" > recomp_algo > > echo "name=lz5 priority=2" > recomp_algo > > > > Recompress pages using algo 1 and algo 2 > > > > echo "type=huge threshold=3000 algo_idx=1" > recompress > > echo "type=idle threshold=2000 algo_idx=2" > recompress > > > > Maybe we can even pass algo name instead of idx. > > Or pass priority= so that interface that uses algorithms has the > same keyword that the interface that configures those algorithms. Hmm, why do we need algo_idx here if we already set up every fields at algorithm setup time? My understaind(assuming default(i.e., primary) algo is lzo) is echo "name=lz4 priority=1" > recomp_algo echo "name=lz5 priority=2" > recomp_algo echo "type=huge threshold=3000" > recompress It will try compress every objects which greater than 3000B with lz4 first and then lz5 if it's stillgreater or equal than 3000(or same size class). > > I still don't see many use-cases for "delete algorithm", to be honest. > ZRAM is configured by scripts in 99.99999% of cases and it is For the development time in the local side, people usually type in until they will have solid script version. If we asks resetting to zram to modify it, it's not good and consistent with other sysfs knobs we could overwrite it to change it. How about supporting overwritting to chage it over priority? echo "name=lz4 priority=1" > recomp_algo echo "name=lz5 priority=2" > recomp_algo # or I realized to change lz5 to lz7 so echo "name=lz6 priority=2" > recomp_algo > quite static once it has been configured. So we probably can use > the "don't setup algorithms that you don't need" approach, to keep > things simpler.