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 D233EC4332F for ; Thu, 14 Dec 2023 22:11:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 626158D00EF; Thu, 14 Dec 2023 17:11:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5D56C8D00C7; Thu, 14 Dec 2023 17:11:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 476FD8D00EF; Thu, 14 Dec 2023 17:11:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 357628D00C7 for ; Thu, 14 Dec 2023 17:11:54 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E95EA1403F3 for ; Thu, 14 Dec 2023 22:11:53 +0000 (UTC) X-FDA: 81566822106.08.FA28F46 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) by imf08.hostedemail.com (Postfix) with ESMTP id 943EB160013 for ; Thu, 14 Dec 2023 22:11:51 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=02h9CJuw; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf08.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702591911; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kjwv3SJYpxnhyyliVohhGYpPw4WBD1Rbfb+MQW+rnxI=; b=IcN0++SsTKui0aomStOKeh6oljyKXm71DMc08bkbmL/wGsPWW8iTdMQXLZXKUgzMANY+2L R+PsU5tbeLw3tsfBknnfvEKA7eemhd1zNKRwkjiTkify6EPhRV7dpvX3b4Vs7sAtlLhQog lHkLq/GwF+c4uypDkTI3EsozvcCD8zI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=02h9CJuw; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf08.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702591911; a=rsa-sha256; cv=none; b=56hduZW6KL8y6u16xrKSClxInEV5dMiwlXCguYmS1rJ0ilxAli6frHyBcO0xR+iYBDDd/M HTjpT5flepR+s0g6QjsbwXa4WW+TFvraBC62k1+vRJXCQUVHuS/Q6EEVfo3bIDb0jiid5L 3ZbsWWHN1fo3gRPcgsIzjx8VFa6dP4s= Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-77f42ee9370so2616185a.2 for ; Thu, 14 Dec 2023 14:11:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1702591910; x=1703196710; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=kjwv3SJYpxnhyyliVohhGYpPw4WBD1Rbfb+MQW+rnxI=; b=02h9CJuwPAmc2VlPNQ2o460OP/SCKh/RcpGLgr0IIGDcgGWnVyTJZWtklqIbfkSTaR 2+9evfLDmseyRplixWHBZfFwJZuCi6cIMOLAUrgbxeqbXz646Z09AF29AgcSEAavDjpa EN+OB2zpe40IU8/13Iru6hxO3x0YVWuu2yWJmteFo/dMJxGRenf3At+jmj3Zr1sI6qNX NK59i3TZ5OiY10LnaQUN2iEB15D0gGxklA85YZzXltBm6hnWaDdez4/RkVw6DMkZ8ppC f49YHg2aqIAua2HGJzKQXNfDZIq+3Ot0u6p2NNHdU00cfagNrugJ5eAXGi0Tw84w0XsX vcpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702591910; x=1703196710; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kjwv3SJYpxnhyyliVohhGYpPw4WBD1Rbfb+MQW+rnxI=; b=J31o2bIbpor4E77x3LkzAW9XESCBZMM4v2HbgfwhwNTn1pXcesZ4FGfpBDT4S74Ofk uYEAlF4vUMKKWPbh9a4UZ9TVUB5tZC+a8jNLSQm6mn03sL5bBVTLBF4UgMNT+QM2VewF FcFnSkTKx5Qpc/E32zzs2I14SHW68NbUfRbVOmcjpQoOqTCDy0Ts+GZTundCJoxFkHgb u7wmYhikJWzN5CabVjYxxy3g0lR70eNSJBg0E8r4Svbf3NP9vM2oQFJJ/96KsG+RhO/7 FPj1bIsjF6nBVzv7blSBT7gj+HxOwz/YLbYsRpoOK60JGgJiH5DgPw03NAlX2r7w7rd4 RZ7w== X-Gm-Message-State: AOJu0YyNmLeNzCYyWVbA9xd1ttitbMLwmdbKZsR/wy60e5CTAiUSIDqd SuoBEpUxlj+oClD719PzaqDP9w== X-Google-Smtp-Source: AGHT+IH8MEU6gyt/5zMK0G9MuFTf5ejKeS/GhVs9rnBbhhJ/HrYy6VGWyrA6SqrFUQ2kzJV6LwpxRA== X-Received: by 2002:a05:620a:1a91:b0:77f:36a7:1437 with SMTP id bl17-20020a05620a1a9100b0077f36a71437mr15760905qkb.114.1702591910653; Thu, 14 Dec 2023 14:11:50 -0800 (PST) Received: from localhost ([2620:10d:c091:400::5:a0a6]) by smtp.gmail.com with ESMTPSA id dv8-20020a05620a1b8800b0077dbdc40458sm5660153qkb.1.2023.12.14.14.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 14:11:50 -0800 (PST) Date: Thu, 14 Dec 2023 17:11:40 -0500 From: Johannes Weiner To: Christopher Li 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 Subject: Re: [PATCH v6] zswap: memcontrol: implement zswap writeback disabling Message-ID: <20231214221140.GA269753@cmpxchg.org> References: <20231207192406.3809579-1-nphamcs@gmail.com> <20231209034229.GA1001962@cmpxchg.org> <20231214171137.GA261942@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 943EB160013 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 96g1qci4n4zefjdywcxj34tcmujq1au4 X-HE-Tag: 1702591911-395923 X-HE-Meta: U2FsdGVkX1+X/N9ZE8+shuYOTljl8smTcROMyQQYDwoadizSN4/+sheMfHA9hxoEAXnLDKSfNPHwoTVpTaKZKAygzdOL2FeM3X9OfgWukCXXdLvPznIHdopksZGjmSyaya2xZWKXTwYTCeP+1l1wVbzusc30g7wxZAh5iukhR6Tp4CBYF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KmcQu3RHXhGbKAh8RuPDvbkv2A+JU30plWczyfQnB9Ls0CrE/VV4WmjmZ0jAUR1Y0VRHgy9/WtirCAdlySm1mqcJ9AJwOgG+lKZUqMbnYHQEEiALeKOFF9QUm327hzLcGnAtxNDIxddtJ4pHJhQ5Grhaoif4fQv8HzwgfmPGrIhJJ0OOzKBeyr7TXPAxqHL/OH8KYcBKD9IPGqXERrElO013EzG+XXm4TjurixcI17GunQalaaPh23SrF7/Dgri0qf/gcVDHgth88qfKNhbbVb7k8Q5TZUtl3vbAnT9Izy+vr36LyHxPVh8F6/ABwVIgq2NFUR++lrWHs/qYvaWyvMwdY9Kd X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Dec 14, 2023 at 09:34:06AM -0800, Christopher Li wrote: > 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. Why is that a problem? swapon(zram, cgroup=foo) swapon(hdd, cgroup=foo) > > 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. Except Minchan said that he would also like different zram parameters depending on the cgroup. There is no way we'll add a memory.swap.tiers with a new configuration language for backend parameters.