Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp1653298rwl; Fri, 4 Nov 2022 17:21:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6cmWngRTR0oOXrUoh+lgtPlaxGQ6jRpvUt17w0JeHdt3FTbarV3sJaeQSLU3mhhakgkODE X-Received: by 2002:a17:906:504f:b0:7ad:fc14:fed2 with SMTP id e15-20020a170906504f00b007adfc14fed2mr17306612ejk.611.1667607683800; Fri, 04 Nov 2022 17:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667607683; cv=none; d=google.com; s=arc-20160816; b=D3JTLhOSlHwXv+2EUhb3H0nkleR23mvSz7Iddmrmp0Q0TYbJqwjaBTfoJ60BGdC3hR jxttR2XXoChDmd6njC2iS3Po5pcusJP4Yo07yN5nqzvrMxHnVsm4qOpL7z4AqIsNgU3b szWly8SRELLYWyQ7Tf5dG9QfQCQ4edO2hy/tLKtsihut1aWJHldYKvqtItu/M0VRneFI oRD8FFfDvALTub3r4Hyg9DK3mTT9c3GqrWpYarYZguMCA499BJoVMl0jqt2vxfWRGhn9 yS5tJzb/giFSObagNCNR2+qLzFcAn4x6YbStPK5/534M3llssH1JI8PMz2LuQ87kCBsj JEyA== 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=RKl6alRuyxYj1V9fsCihyhQ/9yoLUbWIO6qNGczpw5I=; b=L8T7sZL5udzVMZo5CUo8xXLEuY2lMJFWfHGXhZTpoOce0zAzBa/2gJ7y/K5DO257GC Pfc6qtmD8AaBRIBy7UaP8AvqOGXbgMf1OfRCng0IdR2NO4UiRmX5tTUSFCF5PiZoUMA3 CeixzSAAq4dd3DXb5ZI9l/SHmhE3pobjqfh3xdhB6fEAwIEnR9aepXFQwjSGiUXF49t6 419fe+EwjFHPd73JCkVdPZ4wuuBwzQY+q4Nv0sUKF1urg30oTUzQDXA8EHYjRY+0q9LT oL7W/cm4j/yWhv4uMaR3g3B5wPDbqgX1PV95ukUwxjVbnvymEFkUvwk2/waD7aatrKdS 14dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=kPOAfsmU; 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 m17-20020a056402511100b00461b8e2c7f4si1168515edd.548.2022.11.04.17.20.59; Fri, 04 Nov 2022 17:21:23 -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=kPOAfsmU; 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 S229578AbiKEABU (ORCPT + 97 others); Fri, 4 Nov 2022 20:01:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbiKEABT (ORCPT ); Fri, 4 Nov 2022 20:01:19 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D4842983 for ; Fri, 4 Nov 2022 17:01:18 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id p12so787128plq.4 for ; Fri, 04 Nov 2022 17:01:18 -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=RKl6alRuyxYj1V9fsCihyhQ/9yoLUbWIO6qNGczpw5I=; b=kPOAfsmUPRckxdGsMryHVCdI+i5mRK2N4CvPwf9k6b+dP0GTSUDo5j7Jht029vCu6F CwhhdUrC42mrZ9hc4VyqcZfhFdjB0dXqwib4zZ0a3UGFqvLLdtDWUs5abyuegj0QC/Lb Z5L5EI23W+gGVgvk7m3o3LTgJulpaekyzrMPU95pzyvjAwi5Z6/APLz9WggDqtbTUbD1 zswLciRPaoh/NnWI+vfBO19i0+yS7b6dvHX50OFvvxMZH37NfqDH5Zf7aKpDDsKsUMJ8 n5v1uGEvnLCTnWwVYyp4xw9+Rti9Y2RkYQAtw9wrlp6BvJAdIKQU4uJ3VwIJ+SttaNdR KUCA== 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=RKl6alRuyxYj1V9fsCihyhQ/9yoLUbWIO6qNGczpw5I=; b=j3WjPDf0MFRN20HYH/jlZN5sRfrJ9lsMdGj2tS1JhtlCKuYzIvvEZ5ceviJGW2Xe11 N7CG9uPSmdVMsMmnnc4V7cyeT5AA/83Lnbfg9kslIyTitdpyT2uJUVeeMOyQowp21L1P xaL9axXkat0OpjqpxB1lIYG+TGlLriqd+iA/DB03q2nR5zG39r8CCMFusY0nTS7Mbtez Ac9vioWuO8S1whhBY2d9hjZQbHgkyXD8RBHNZUCMWA8MNPGRvcxI+wk9WMSRvIbAkwXU Wqc3JLTD3zSQF2h1dgSevdmcvn4wXA697BmdILsYLj+1QIRCERMw/NCSEACqJ1x4yqCg yEhg== X-Gm-Message-State: ACrzQf0S0ltOTBP9LkpPyghDtjYlMViInoL6h/lVEI1vK4R5dEc4rqNj IeV5fgb89vBxPAilcJWsw5Y= X-Received: by 2002:a17:903:2348:b0:186:970e:739e with SMTP id c8-20020a170903234800b00186970e739emr38652063plh.115.1667606477564; Fri, 04 Nov 2022 17:01:17 -0700 (PDT) Received: from google.com ([2620:15c:211:201:755f:cdcb:1bd8:5ad8]) by smtp.gmail.com with ESMTPSA id e63-20020a621e42000000b005385e2e86eesm188005pfe.18.2022.11.04.17.01.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 17:01:17 -0700 (PDT) Sender: Minchan Kim Date: Fri, 4 Nov 2022 17:01:15 -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 Sat, Nov 05, 2022 at 08:41:37AM +0900, Sergey Senozhatsky wrote: > On (22/11/04 10:43), Minchan Kim wrote: > > > > 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). > > One can be SW one can be HW. So I thought about having flexibility here. > Instead of doing > > for (idx = 1; idx < MAX_IDX; idx++) { > len = zcomp_compress(zram->comps[idx]); > if (len <= threshold) > break; > } > > We would just directly use the suggested algo. > > But we probably don't need that param at all and can use > the loop instead? I don't understand what param you are saying. I expected the zram->comps array already has sorted algoritm based on the priority so the loop will try compression as expected so loop is fine. Are we on same page? > > [..] > > 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 > > So the latter should delete lz5 at idx 2 and put lz6 there? > I can add that. Yub.