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 53A6AC369C2 for ; Tue, 22 Apr 2025 06:17:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 774216B0005; Tue, 22 Apr 2025 02:17:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 720E16B000A; Tue, 22 Apr 2025 02:17:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E8876B000D; Tue, 22 Apr 2025 02:17:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 403FE6B000A for ; Tue, 22 Apr 2025 02:17:06 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D74CEC0D0F for ; Tue, 22 Apr 2025 06:17:06 +0000 (UTC) X-FDA: 83360672052.28.E12BE0A Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) by imf06.hostedemail.com (Postfix) with ESMTP id 446FF18000A for ; Tue, 22 Apr 2025 06:17:02 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Yah5/o1V"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf06.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.208.170 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745302625; a=rsa-sha256; cv=none; b=wiGX+Z4CVbwFlQ2AXCo9FH0BHtzn9C7VhFcvKwG34ISLR/Bqr/s3ooTx1v0FnMvKIQs9Rd xZfcgcytj1ezpmOLtHqL4aR/GGwIPpjvjoCnVeTxEvEZmdZE3wFOL3nqNTVO5/2I+igXAd Oz0t/7CyAeOxFc52jsq5+k3c2VWmpPY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=bytedance.com header.s=google header.b="Yah5/o1V"; dmarc=pass (policy=quarantine) header.from=bytedance.com; spf=pass (imf06.hostedemail.com: domain of hezhongkun.hzk@bytedance.com designates 209.85.208.170 as permitted sender) smtp.mailfrom=hezhongkun.hzk@bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1745302625; 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=5D2izRsgAKYHtxRvzimEvoU0qAt1TpW/2ApDuRS+Tj8=; b=V8StcZAlzTmtK2jWLF3mqRe/VGqq86pMX727AzpS4gv7sM3D2BfAOdGL2UhtvQqNpRjEmW a97/S37qh1h9WeRpeZmBj1DHkEfq1oZ2OsukF+V51P8gIQ0JAlm9qU6crioSNM8Ss/zv9k n5EAMio6QBjYFL0CuYReFYakfAdpWZI= Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-30bf7d0c15eso45188551fa.0 for ; Mon, 21 Apr 2025 23:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1745302621; x=1745907421; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5D2izRsgAKYHtxRvzimEvoU0qAt1TpW/2ApDuRS+Tj8=; b=Yah5/o1V1wgcvEZDl8MSwnbKzAph117gc8BuZ2MBaNujYWFnqpI16bUj7pZuKWgvgO dFJrKzsKYq+MKYZBWZ4S601nlyRklcejLJHfI7Q7/ZPEVx43a3WW9JzS2wEaekqmwEGr lSpo3BBvjEUHWCmTANFtDgKrXQh0bn3A64enDHrtPpVjidmDrVkWpd5CVnt3kyPan33J ZiR1PIlRrNqPiLjv+n1UnPnwtlrotckfamOlgGCnz1iFIOB1F+9pMtcaHOeM6HVVxqbZ uUK0OsnRFPHR3CdYFkdqIF1r/C6SBfozMAuJfN2iRjxLgaigJCWclujccUXuQHGv9t89 fwKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745302621; x=1745907421; 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=5D2izRsgAKYHtxRvzimEvoU0qAt1TpW/2ApDuRS+Tj8=; b=q8/7/nEtDaj/SRpxvOaR2YLeWvb7GdFP5FOK2CwRfYZwL0aA7sf9ocdhD4kvYTyhYA ouubfwXGPn0lprvGpc0IQtpMeIArBmvUPFoqOtXtMRA8wU4LCeUueeEwWNN8TpKaFarA 4tPOLf+OPjHB1hRq40J27z6FPV+xLspR6+XhscHhQFVZL6l5Aep4KUtJ83lAdHRjoUE5 k2TIPt7lsLgP/vz4eI/yHDzzTiElE3KZkL4awyqHC+QXHQ8zSEaqU7HVmj7f4NJU9Vrs ZguxT9BsAFkF0ctVfilx2uvfc8ApyBZDzwtK3Rq5Y1VI1nju6x3YUoLlRmWxDrr4nu/e Ds7A== X-Forwarded-Encrypted: i=1; AJvYcCXpkYX0fDZBxveAibcwZU5HRqeFoW3dJqoGNyE0hm6tQF+9SRf3TmX6dC6Z1HU1wH5soWMtgA09og==@kvack.org X-Gm-Message-State: AOJu0Yw+y/YhPaB6c1F2PjUAsBvNFZPhyceKcOsOkbxgjwDyVCvl/nG/ eoHcS1S4P6PoLhqIOxYMbirnqZv13ek/dh7G3IdqWRdUKNaUHAZkoCYmmr82Nt3upA8Tk4bjn1H tuH2XZCLVYU+UYhdz0A+T486ZC10xz7/Xy2pJMg== X-Gm-Gg: ASbGncskICxerMqR0CN03r1lKBPAuAGPYd//vPLOoy2t1/56edBs5ATAL3vD9qQCYMN E76V35DMrffgQtmGZ/LkVgWFCAlqA63N1/8uTJtb3u/NhEHr7vT2wrqLTTBnm7wySivAp2E3o1a HeQ/taC81KtmVVh67QK9ZN5F20VqPlRm2PpDxlJ4zOYPiAeg== X-Google-Smtp-Source: AGHT+IHGRS0qXzqle3yGdgHA6X1Qi3PEyAPNmnLh3Z4tRHEAfO7fglaouhYhsnKctKLyXZ43gMvBVIsV8Ih4fj9V2oc= X-Received: by 2002:a05:651c:154c:b0:30b:fdc0:5e5d with SMTP id 38308e7fff4ca-310904c7bc7mr43871941fa.4.1745302621034; Mon, 21 Apr 2025 23:17:01 -0700 (PDT) MIME-Version: 1.0 References: <519e12b9b1f8c31a01e228c8b4b91a2419684f77.1745225696.git.hezhongkun.hzk@bytedance.com> <972CD38C-9084-4CC0-8AD7-127745CACCDF@linux.dev> In-Reply-To: <972CD38C-9084-4CC0-8AD7-127745CACCDF@linux.dev> From: Zhongkun He Date: Tue, 22 Apr 2025 14:16:23 +0800 X-Gm-Features: ATxdqUE7T5mpqo-BO9nWbrFqaTpCcysceYqZubv9UTiQZybzW2fT_qeWz6DV_qY Message-ID: Subject: Re: [External] Re: [PATCH V4 1/4] mm: add swappiness=max arg to memory.reclaim for only anon reclaim To: Muchun Song Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@suse.com, yosry.ahmed@linux.dev, yuzhao@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 446FF18000A X-Stat-Signature: 945kpusm6tg9n5gqs546fatjc7j66tdw X-Rspam-User: X-HE-Tag: 1745302622-288586 X-HE-Meta: U2FsdGVkX19m515Z6uBg/uWhZWjL21978Bo/f2/1XY7IpgNY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xnsj4KxBHzPUY8KLnza6+J3kq8wT3h6xn39v/LkYsBTpSd93dfCHougrT2niFxcVo7nUeK8C8HTrA7CzyTSIFJiMiVKbvTxc0kR9yUpKtAEFpPl1xO/Pv3bSbvlMLse4hlTv+JYGcJeR9m7clz+4o 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: List-Subscribe: List-Unsubscribe: On Mon, Apr 21, 2025 at 5:35=E2=80=AFPM Muchun Song = wrote: > > > > > On Apr 21, 2025, at 17:13, Zhongkun He w= rote: > > > > With this patch 'commit <68cd9050d871> ("mm: add swappiness=3D arg to > > memory.reclaim")', we can submit an additional swappiness=3D argum= ent > > to memory.reclaim. It is very useful because we can dynamically adjust > > the reclamation ratio based on the anonymous folios and file folios of > > each cgroup. For example,when swappiness is set to 0, we only reclaim > > from file folios. > > > > However,we have also encountered a new issue: when swappiness is set to > > the MAX_SWAPPINESS, it may still only reclaim file folios. > > > > So, we hope to add a new arg 'swappiness=3Dmax' in memory.reclaim where > > proactive memory reclaim only reclaims from anonymous folios when > > swappiness is set to max. The swappiness semantics from a user > > perspective remain unchanged. > > > > For example, something like this: > > > > echo "2M swappiness=3Dmax" > /sys/fs/cgroup/memory.reclaim > > We already have this kind of style (mixing numbers and strings) within > io.max under cgroup v2. As a result, I'm okay with this change. > > > > > will perform reclaim on the rootcg with a swappiness setting of 'max' (= a > > new mode) regardless of the file folios. Users have a more comprehensiv= e > > view of the application's memory distribution because there are many > > metrics available. For example, if we find that a certain cgroup has a > > large number of inactive anon folios, we can reclaim only those and ski= p > > file folios, because with the zram/zswap, the IO tradeoff that > > cache_trim_mode or other file first logic is making doesn't hold - > > file refaults will cause IO, whereas anon decompression will not. > > > > With this patch, the swappiness argument of memory.reclaim has a new > > mode 'max', means reclaiming just from anonymous folios both in traditi= onal > > LRU and MGLRU. > > > > Here is the previous discussion: > > https://lore.kernel.org/all/20250314033350.1156370-1-hezhongkun.hzk@byt= edance.com/ > > https://lore.kernel.org/all/20250312094337.2296278-1-hezhongkun.hzk@byt= edance.com/ > > https://lore.kernel.org/all/20250318135330.3358345-1-hezhongkun.hzk@byt= edance.com/ > > > > Suggested-by: Yosry Ahmed > > Signed-off-by: Zhongkun He > > Acked-by: Muchun Song Thank you for your time, Muchun. > > Thanks.