Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4991196rdb; Tue, 12 Dec 2023 15:58:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvMVUbBoT9BGqMi2CsMevtGcuNu43fWvwrxDIr6mNUefxQgOimSctQ5orjEiq9k+GrNfa5 X-Received: by 2002:a05:6808:11d0:b0:3ba:4c6:f39b with SMTP id p16-20020a05680811d000b003ba04c6f39bmr6060556oiv.98.1702425523614; Tue, 12 Dec 2023 15:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702425523; cv=none; d=google.com; s=arc-20160816; b=krbIcWpBvoGLaWFdjUlGLJr21LBmLRqlXagYOKhFtlr0PIXc1WWj58eJUqzuu2xj9B n3j4/VpH+Z+6WHQVFW9uLALlYAf2/kgiBcjK9t87khtBFu4XnlkZhAExbOD9+QvJ+I+5 sEXqK03jJ1eRrLOxbrRZgVknaUlRdg/R3G4ERR5Q4cIJcblXCYw88Ehl96nLeK9YqP2f cSqTdABVxojafdbBfvOxYNfC+pFGz92qg1R5hV1mDb4638kgMOVyZzRFeXJgSjBi04sn XmFrgmlRRCRfrVKZngpmLOpaoblKsyke8VQN9t8rDlQ2hHQ5a/AAOA/sxHwsrg1DfdiY 3ynA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hPz99cd9ncMhdqhEOW52ymvh41nJ6piVW+kmsgXYUQw=; fh=iWJhbkZ+P/PnLotgQXsz8CLRCYvNwZX4TbEn2h0u0Oo=; b=WnkwNT0hVj4jeZ1/M3SgMRbwlGs+8L8VilvJbiKHwECCK8xj4STTvyA0Qa/YzR7ej0 jfFkI73u6Rs77SmU+MNNbeV/2GtDV86StGER++8WXg3DKJi7kClGcvPgK7TT3qtRCnB3 FAUX3Ql3VfQaEdsl0/JE5BBnJRLWFgZzomgKBNZcLD+8O1frl4TOLqPheUrASIzuqBPa LNHfmnquRf6YTO1uwp9eWOeF2MPmAQ9yvKAeyW34edjMlb1rwD7fak6kP0QiBawEQg7M iZsyB+6dKnGU+Yrtv1ZvXOplGnG2TdUzfdPbKwDuA/zWI19szPiX6UbbxTCy/NbjZfm8 pF+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uXN29BNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p7-20020a170902e74700b001d340ea6050si1273286plf.335.2023.12.12.15.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 15:58:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uXN29BNc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BB0F08050F84; Tue, 12 Dec 2023 15:58:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377597AbjLLX6T (ORCPT + 99 others); Tue, 12 Dec 2023 18:58:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232630AbjLLX6S (ORCPT ); Tue, 12 Dec 2023 18:58:18 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9175B7 for ; Tue, 12 Dec 2023 15:58:24 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83D66C433CA for ; Tue, 12 Dec 2023 23:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702425504; bh=hPz99cd9ncMhdqhEOW52ymvh41nJ6piVW+kmsgXYUQw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uXN29BNc1wW3MHydt/a5ostC/bbsjV9exXkmVGhzvYs3RaWt1pypq/i80IgN7pNWp TtFL/mP+MUvAuLX++eFkZTYJF9o9dUT9N2eEH5UNwFAkHGvdIa18qmE3+uTS6Rw93i Vz7IbGdITYVBWtB2enE7Pb6OM8no+764vOz+N8z5fTHipSqjRVxeyx5bIYrNIfnhBo Gd9B6gXfyR32S0854xczVTAxjZO1j131Zi0ov2X/TO4r0AfDvWiKVPa9FH1a+BbFlw NV0bqdODbe5IPdiFeOhpAyoi1L4Df17OmL/51GfOaw6nOiOvcBFphD/6PqOcY/daLD +sezSRrJ/uDWw== Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-425a84ed4bcso34977501cf.3 for ; Tue, 12 Dec 2023 15:58:24 -0800 (PST) X-Gm-Message-State: AOJu0YzgMMm05Reo/tjMSDO1cEEO2vIukEHyRf9J0gNs8WQNWxmV4NIC wjhnWdnYHcX9Vis5BvnLZ1YMDQO0PxHwfAGIGMKHIQ== X-Received: by 2002:a05:6358:7296:b0:170:17ea:f4e4 with SMTP id w22-20020a056358729600b0017017eaf4e4mr8579237rwf.49.1702425483026; Tue, 12 Dec 2023 15:58:03 -0800 (PST) MIME-Version: 1.0 References: <20231207192406.3809579-1-nphamcs@gmail.com> <20231209034229.GA1001962@cmpxchg.org> In-Reply-To: From: Chris Li Date: Tue, 12 Dec 2023 15:57:51 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling To: Minchan Kim Cc: Johannes Weiner , Nhat Pham , akpm@linux-foundation.org, tj@kernel.org, lizefan.x@bytedance.com, cerasuolodomenico@gmail.com, yosryahmed@google.com, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com, mhocko@kernel.org, roman.gushchin@linux.dev, shakeelb@google.com, muchun.song@linux.dev, hughd@google.com, corbet@lwn.net, konrad.wilk@oracle.com, senozhatsky@chromium.org, rppt@kernel.org, linux-mm@kvack.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, david@ixit.cz, Kairui Song , Zhongkun He Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Dec 2023 15:58:40 -0800 (PST) Hi Minchan, On Mon, Dec 11, 2023 at 2:55=E2=80=AFPM Minchan Kim wr= ote: > > > 3) Android has some fancy swap ideas led by those patches. > > > https://lore.kernel.org/linux-mm/20230710221659.2473460-1-minchan@ker= nel.org/ > > > It got shot down due to removal of frontswap. But the usage case and > > > product requirement is there. > > > +Minchan > > > > This looks like an optimization for zram to bypass the block layer and > > hook directly into the swap code. Correct me if I'm wrong, but this > > doesn't appear to have anything to do with per-cgroup backend control. > > Hi Johannes, > > I haven't been following the thread closely, but I noticed the discussion > about potential use cases for zram with memcg. > > One interesting idea I have is to implement a swap controller per cgroup. > This would allow us to tailor the zram swap behavior to the specific need= s of > different groups. > > For example, Group A, which is sensitive to swap latency, could use zram = swap > with a fast compression setting, even if it sacrifices some compression r= atio. > This would prioritize quick access to swapped data, even if it takes up m= ore space. > > On the other hand, Group B, which can tolerate higher swap latency, could= benefit > from a slower compression setting that achieves a higher compression rati= o. > This would maximize memory efficiency at the cost of slightly slower data= access. That is a very solid usage case. Thanks for sharing this swap backend usage story. It goes beyond my original memory.swap.teires idea as well. We can have some zram specific knobs to control what compression setting is using. Moving data between different compression settings would be an interesting topic. It might fit the swap.tiers usage model as well. I am just thinking it out loud. Maybe define different compression settings as different tiers and then allow the cgroup to enroll into one of the tiers list. > > This approach could provide a more nuanced and flexible way to manage swa= p usage > within different cgroups. > That is again very wonderful insight. Thanks Chris