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 ECB34C4332F for ; Sat, 5 Nov 2022 00:01:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5AAC78E0001; Fri, 4 Nov 2022 20:01:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 55A486B0073; Fri, 4 Nov 2022 20:01:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4225F8E0001; Fri, 4 Nov 2022 20:01:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 316756B0071 for ; Fri, 4 Nov 2022 20:01:19 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 142851A0B20 for ; Sat, 5 Nov 2022 00:01:19 +0000 (UTC) X-FDA: 80097433878.28.36717DE Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf23.hostedemail.com (Postfix) with ESMTP id A123F140002 for ; Sat, 5 Nov 2022 00:01:18 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso9585361pjg.5 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=ORpFmufVgGct2X69oJ/+bA6ky3EV5NjkxDquuJBphkdknmOkLkCECn+gVuoOBF+64q 1lXPEuLNitAMOKj2ziu+OtMQu9ZToRqsiM57N6vT4tD1hlU5/D3Px9hyVykSHDZZA4iZ mBYsIn2dFMcSU6cy3/asuwK8/NHIgX9x7yUQAPrrK1KgV7WVE2fjcPCFy1qWiueISEvx 1cIu9gOTiz66S73Vr6DQcyARVfXPUdSqOKSmZCFnaQLEVuogh7qOJVnBHcQWmwOz3m/t 13c3S1xNBGG9ZBAcPKYtIbsF21nOb0GGhQLMJ2oS/xbnC4gM7tzMFITGn1M4IqSLqmw7 cYQQ== X-Gm-Message-State: ACrzQf3QLvmdVXftrOuWkgcWZYHKMlJbCiO3m26kZbYh65gD3CZGjWQ5 7ANlawOoulkp+GOgsFiiw+UHKC8aBjk= X-Google-Smtp-Source: AMsMyM5XZKt4Bd02vGWDE7A30rUCFf19kcpmhQ1f+4dKKTnbWRWeQuKLJSxAl0q/1zDhu9SQCFfP/Q== 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) 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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667606478; a=rsa-sha256; cv=none; b=6oHJswcsL1QWGfX/CWtLTWtb0x5Y3FGiTw+BQ6LLsqlMokpoxhh9p85p3hboFMZTJC55cY k+4jjyEuceYXSyfGSy6LmhTPJhloiI0AsulmAyI6gHekxUvQxEVHYYG0OAv46xnYju4oBB w600rerSXrn/RR5NQNUrI46IXBlgwJM= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kPOAfsmU; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf23.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.43 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=1667606478; 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=RKl6alRuyxYj1V9fsCihyhQ/9yoLUbWIO6qNGczpw5I=; b=lN2erH1rm/LB0ySxW2IjVx5FTZg3ZUxCGm0jr/NMSCAMUW6OWqMB4BMR5xUU2xmZbVnAeK sTj/64Oc7DciD+F5NahmrKc47JeO9HSexbtsiHZ3+SKLaeAH/ufpfSIZwBKUt6nRvwYbjO SrJPsvcX9G8MstdlIbseXZbOfcVUI2A= X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A123F140002 X-Rspam-User: Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=kPOAfsmU; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none); spf=pass (imf23.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com X-Stat-Signature: w91c8yi1zzccqsbey14k1o4x1ficmbfh X-HE-Tag: 1667606478-191991 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 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.