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 E8F1DC28B2F for ; Fri, 14 Mar 2025 06:12:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BBF9E280002; Fri, 14 Mar 2025 02:12:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B6E93280001; Fri, 14 Mar 2025 02:12:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5F19280002; Fri, 14 Mar 2025 02:12:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 88CC9280001 for ; Fri, 14 Mar 2025 02:12:04 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 71C0480B4C for ; Fri, 14 Mar 2025 06:12:04 +0000 (UTC) X-FDA: 83219136168.10.6211082 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) by imf26.hostedemail.com (Postfix) with ESMTP id 8C57A140004 for ; Fri, 14 Mar 2025 06:12:02 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ckkt9XiV; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.187 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1741932722; a=rsa-sha256; cv=none; b=f7kqeAkzvstwOvCU6IfuZ6cA6h0y2Cl7vJhwvGpCeWI4IAwInLfmSunIFjq+kzqBroQcYq JoqgiGF4Bqw8mqzQf2hJ2wVlXu+YS/nR7nRjXI5pleGzp+CECcVttVdmlHBx9TnqpzOLhF XBu7+J/J0rCENAvdCaof4HsO5R9tfac= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=ckkt9XiV; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf26.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.187 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1741932722; 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=c4tvhtoi8B+ZP0KS2yGU1l6szw3cCmdQt0EmCPV2dCg=; b=lSLAPUxPE0VzBoK/fLsuexZTq+xo5mu6lYi/JjFOj6i1cn3U9tqgAaqU9HE0F2I+ShRC5p k1Jpuy7R3T05Xc2Y2eL5RKCGbwcteTFtaxfCZFWicSe9cc41MeSr4SYq+8//agufTd4Trl 18cOelV9RERzf5irXvZulEtqq4/QL1g= Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1741932720; h=from:from: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; bh=c4tvhtoi8B+ZP0KS2yGU1l6szw3cCmdQt0EmCPV2dCg=; b=ckkt9XiVUiQnyCaLgfq2vuFYksNAz/OrwDAIxHiAfU/cNQ0+RGmt7ecdOM6oLdIycYpeV5 bqE+piyzNKd13hKFmG/947ztNxH14n9w/3Qfaob55pQTUd/Ru/ogUsqQTcopX7t0p3LyBn GuHJTfgKvk2gJTaZdCBritT6T5gV2Bk= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PATCH V2] mm: vmscan: skip the file folios in proactive reclaim if swappiness is MAX X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <20250314033350.1156370-1-hezhongkun.hzk@bytedance.com> Date: Fri, 14 Mar 2025 14:11:21 +0800 Cc: akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org, yosry.ahmed@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <829B42A6-4EE1-4875-8D97-1AB0341C85BB@linux.dev> References: <20250314033350.1156370-1-hezhongkun.hzk@bytedance.com> To: Zhongkun He X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Queue-Id: 8C57A140004 X-Stat-Signature: na14ynbb8u1pmxg7zkx8sn9n5tuud9eb X-Rspamd-Server: rspam06 X-HE-Tag: 1741932722-84152 X-HE-Meta: U2FsdGVkX1/QgUdsEEcJZ53lJb+UAFv9oRgrJlLQ559pEdLRt3PLblKecpzEQZzWaWB1V87R82ldH+vMGgynoEaDeK9cyznK09cvD/LvhuAJxe6hCGMbzcD/Bpg/ClmWvJYjWLMfVnwOgwsmWWvllZ7tfcwunAiG6q/jEjt2wLPmyBjb//9fmWI3izO8CokS9g54T2AK62fzb3oAvN0XTWU8yGaju4VD6gA6g/LaZGJPYKEZypF0PEQVXRavXr/A3xDf3wcRlR7pj5Dy8v/ePDCpLu37K2Art04H8k7MmtTPRKwZUsMthJJh6hhBbdX+ZG4qVE0R01Mm6TVOBLopTqCh+eftETaheYe+h0m95se7m17REIDnED/zhu5ZBT0eB+0ZGxFlkRBIYOwziBbOF5USDJBtGzYIZbIaLFJLvZv4RbNl248TiXj3erfAktMrYZXpgrMgMhDkiC4zDPUi+6KkD2BQaOFi+1liXrSWfqTpTiPIWaNhqpFfm353db6wo2wB8iXA6REauhY6RH420KTok+F0nzO50WIdzUQpRRhE/EnPEHLN7kpfUdcKOYnIcTcZvQFKqX0CBanVlYdjt/uYc4lxFtr//a71uR0M5Y5pYL0tpYdQ6H+kEBxfMCN+FRfOzVDPeXSfUYMoDJa+oaFJdVVuwIQdNHkFN/DgL7/GL7ug+QIS+fSWLqmvaReWHJSOy0Ge8ORzSIEgUmUzcs4szKZ6nEslEMqAC8ujhJjVz4SV9m0zO8M/miwkYrw41uUO9t/i2axZdvmiaAsyLKCVuxWcbBLYbwSgNTuwSt/xb6DoW/kBn87/UE7HRzH6PkKBjAnzvZuXB82nLvIy8wz3nVtzGuMJihFa6FhVaC0AQTK4GqOm+r8AtHu34LFh1v+cUwi9OBtuHEv9J7wJs/FQOdrAZ79AP0Qd42R0qO6DhSp82uLXRJxJFDcWzC24PeoX88PTHfHP0LrIpRP YMfEe0y7 8IkpQSBPupi+vuXszLnuuVlqq2RQyB3HzbpxYgIkSU1JBMlBijjpbCYpokvoSHd9ADCWf2ikvpYo6W0c9v71MUt3VrDC2bnvHJCqbUlfmJKJPY463eGgp556XJtuoklUSGVg2b06EFStmZXESKxf1Yn1TkKEDh1x7cV60xI6vlsO2GoCB5YnLL+KsUvJ51E9fDaVngT2Ughn708R6YieJrWdjgJOgRtecJgRFpwaZFTVqUkcgzVaxuiuMt3EHlsomH4QIN/fyLiugcU882jfYugWM9G8yvJ9vdnGm 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 Mar 14, 2025, at 11:33, Zhongkun He = wrote: >=20 > With this patch 'commit <68cd9050d871> ("mm: add swappiness=3D arg to > memory.reclaim")', we can submit an additional swappiness=3D = argument > 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. >=20 > However,we have also encountered a new issue: when swappiness is set = to > the MAX_SWAPPINESS, it may still only reclaim file folios. This is due > to the knob of cache_trim_mode, which depends solely on the ratio of > inactive folios, regardless of whether there are a large number of = cold > folios in anonymous folio list. >=20 > So, we hope to add a new control logic where proactive memory reclaim = only > reclaims from anonymous folios when swappiness is set to = MAX_SWAPPINESS. > For example, something like this: >=20 > echo "2M swappiness=3D200" > /sys/fs/cgroup/memory.reclaim >=20 > will perform reclaim on the rootcg with a swappiness setting of 200 = (max > swappiness) regardless of the file folios. Users have a more = comprehensive > 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 = skip > file folios, because with the zram/zswap, the IO tradeoff that > cache_trim_mode is making doesn't hold - file refaults will cause IO, > whereas anon decompression will not. >=20 > With this patch, the swappiness argument of memory.reclaim has a more > precise semantics: 0 means reclaiming only from file pages, while 200 > means reclaiming just from anonymous pages. >=20 > V1: > Update Documentation/admin-guide/cgroup-v2.rst --from Andrew Morton > Add more descriptions in the comment. --from Johannes Weiner >=20 > V2: > Add reviewed from Yosry Ahmed. Actually, those changelog should be added below "---" below. >=20 > Signed-off-by: Zhongkun He > Reviewed-by: Yosry Ahmed > Acked-by: Johannes Weiner > --- Here, start to add your changelog. The code looks good to me. Acked-by: Muchun Song Thanks.=