Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6152358rdb; Thu, 14 Dec 2023 09:34:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEG0kgdChfYdHV/BtRc5h0FqR0J46l5fZA0VStJuvYJFl+dQXQQvxnOPurd2mEPNzaAAwHd X-Received: by 2002:a05:6a00:2789:b0:6ce:477b:5c06 with SMTP id bd9-20020a056a00278900b006ce477b5c06mr5942864pfb.58.1702575271651; Thu, 14 Dec 2023 09:34:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702575271; cv=none; d=google.com; s=arc-20160816; b=sq4lquDPTVcxmqRzWatfFXihs7cs3oMds7N8x929j7ugXoV5Hdkfc9M1OTd2x9M+pM x7+GiIUjAmRTfpJc2z5dim49KXW1tljGGwkNKb9OqmhsVRg9jC/7c3Y/huWTVS+EjAiL J8qFEi5x5u60bUV1y1oEqxjDw0wZNaM1YIIpeYl+U5y201oBPVZ9rUVzeY9HDQAqVGtV 8vxfdf1c/Y7xIzvCv35kK057JPESPOv+uW2qAY8Kp/oufHXyDvt+DqtRMEFif81BEhL9 vedPqU1l8Twwio6s1NIP1E+R0wsIcGCPUSqqTpMFeRFeJrVLp1oR2FzpSlU2GSE7ffJE ZQOw== 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; bh=Fhij6nsy5DCBMheEdofImYHOUxwaB6WIIaqcIrJVvQ4=; fh=6VSEClk1KQCKMh4eAnZ6j0YOkadlN6qWdQGJhYsWPfs=; b=vDk77vHQ5cC86eFR3V1CPo2R7V7xJsUA38/aPtj0PFVwgf2Y1OtEBQE8BS3a0oJ2OE PwqUlTCViW0iNr1KPCJy+JnorUmZ5WBa07eswH4Q/6OTlcWdapbkQvpP3MY9VXNlPGVn 1Gpgh2H6fU+Fd10AXoGfgMRkHNhEy5MtKHT3Y+5viyCaw0qr26N32vMdRGwVis0Bgtxm iCzinbsACXv8U29/7OTFhdSxQiCekqRw6Quh7ZnNULv+oi5HvA+9t0vWCyAGJUjVpq6o 9uQiGJllK4HJxZc0nGJct0zpWLXrkNe+QIsJzVdViwLfObG+5BLSvXy45Tx4KVYCDYok K+EA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id fa3-20020a056a002d0300b006cb6fb35b87si11846795pfb.94.2023.12.14.09.34.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 09:34:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id EBC08826A043; Thu, 14 Dec 2023 09:34:28 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229743AbjLNReP convert rfc822-to-8bit (ORCPT + 99 others); Thu, 14 Dec 2023 12:34:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbjLNReO (ORCPT ); Thu, 14 Dec 2023 12:34:14 -0500 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44ABECF; Thu, 14 Dec 2023 09:34:20 -0800 (PST) Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2cc3dd2d897so21397881fa.0; Thu, 14 Dec 2023 09:34:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702575258; x=1703180058; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/I1W7e0WksPQr4B0ossVVfyuwCWdZSDTARqTZ332iVA=; b=CUjRuZsdP0GVflCOjfnGC+WYb4btVNGptBOItvUMAU4UePmZOcczcXjtdzHm2L3H/d Q+k3Y1V/AAs1C+pxIl41XW7NB35N28Lbc7m0S9dPpqbTc4F59Cmunp5/KXpdzAX8sMmz BMO3tfgE+iekoWMQz31HtnCry/89hS7mdaSO9Zo/VmeM2uMPA8NuZ9eT+QGoBSkpfuXV s7hc0TMRKn8ed1GsEog2SBmDUIVhWKV09qqUiC+LLbtLTxjoTMUtAg8+9O+t9EDAgaMp 3a1RAUsSpstsowZVepZ+SuTpLtKqM1XZQ+Q7MI2y5R6rJeV5Ht+Bs+zIcwXlwdJ1ck2n YvZQ== X-Gm-Message-State: AOJu0YzeZYakRRAtUKLBMqcc2xaB9MphqiD2whTZDlBFLiFkoFnyz0pl CEB6Sb3NZOuyojBHDXLkBQjQJ2Uy3D1CLJVlng== X-Received: by 2002:a05:6512:148:b0:50b:f858:f132 with SMTP id m8-20020a056512014800b0050bf858f132mr4870323lfo.132.1702575258112; Thu, 14 Dec 2023 09:34:18 -0800 (PST) MIME-Version: 1.0 References: <20231207192406.3809579-1-nphamcs@gmail.com> <20231209034229.GA1001962@cmpxchg.org> <20231214171137.GA261942@cmpxchg.org> In-Reply-To: <20231214171137.GA261942@cmpxchg.org> From: Christopher Li Date: Thu, 14 Dec 2023 09:34:06 -0800 Message-ID: Subject: Re: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling To: Johannes Weiner Cc: Minchan Kim , 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: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 groat.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 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 09:34:29 -0800 (PST) On Thu, Dec 14, 2023 at 9:11 AM Johannes Weiner wrote: > > 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 needs 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 ratio. > > This would prioritize quick access to swapped data, even if it takes up more 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 ratio. > > This would maximize memory efficiency at the cost of slightly slower data access. > > > > This approach could provide a more nuanced and flexible way to manage swap usage > > within different cgroups. > > That makes sense to me. > > It sounds to me like per-cgroup swapfiles would be the easiest > solution to this. Then you can create zram devices with different > configurations and assign them to individual cgroups. Ideally you need zram then following swap file after the zram. That would be a list of the swap files rather than just one swapfile per cgroup. > > This would also apply to Kairu's usecase: assign zrams and hdd backups > as needed on a per-cgroup basis. Same there, Kairui's request involves ZRAM and at least one extra swap file. In other words, you really need a per cgroup swap file list. > > In addition, it would naturally solve scalability and isolation > problems when multiple containers would otherwise be hammering on the > same swap backends and locks. > > It would also only require one, relatively simple new interface, such > as a cgroup parameter to swapon(). > > That's highly preferable over a complex configuration file like > memory.swap.tiers that needs to solve all sorts of visibility and > namespace issues and duplicate the full configuration interface of > every backend in some new, custom syntax. If you don't like the syntax of memory.swap.tiers, I am open to suggestions of your preferred syntax as well. The essicents of the swap.tiers is a per cgroup list of the swap back ends. The names imply that. I am not married to any given syntax of how to specify the list. Its goal matches the above requirement pretty well. Chris