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 C0612C369AB for ; Mon, 21 Apr 2025 09:35:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C32FF6B0006; Mon, 21 Apr 2025 05:35:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE3D86B0007; Mon, 21 Apr 2025 05:35:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA8F76B0008; Mon, 21 Apr 2025 05:35:30 -0400 (EDT) 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 89F146B0006 for ; Mon, 21 Apr 2025 05:35:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 2934C1D021C for ; Mon, 21 Apr 2025 09:35:31 +0000 (UTC) X-FDA: 83357543262.14.998DC03 Received: from out-172.mta1.migadu.com (out-172.mta1.migadu.com [95.215.58.172]) by imf29.hostedemail.com (Postfix) with ESMTP id 3A8FC120011 for ; Mon, 21 Apr 2025 09:35:29 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=lidvml90; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.172 as permitted sender) smtp.mailfrom=muchun.song@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1745228129; a=rsa-sha256; cv=none; b=7cFn52ptb4jVZ2cEnhG57rX+kdhEtl98jnhxg8Pz3+TEjPnHaLrq/D9DDgRlenWDQrUVN4 mQmdZ24amcHaKa1iLk7jo7qz+ky4yIaE14iPGvJ9tmQaHKvZVa4i8HxECqYVZ640eO5+Di vFP0PAsraQcdpHpxQArerXNsQODFbns= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=lidvml90; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf29.hostedemail.com: domain of muchun.song@linux.dev designates 95.215.58.172 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=1745228129; 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=bUKfKjum813rPN4vzZFzmrYZkvGsU7gI7x8EL6azOkQ=; b=7pUStbTP116IHMwip2+OP1KH0eoTB1+f0loeRJaQejF0DnyBMqD+WT8SuihbFMrvodVNnK Mjn3Xzu5Rzy3bAPjBSxCNNcZJq6efqJc+rpHsYATb0tIr2yadCSHMhGQMnvX8QRSgCDbie V/K5I+0QD6kt9k7HhDjJwNBmGfHI0vA= Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1745228127; 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=bUKfKjum813rPN4vzZFzmrYZkvGsU7gI7x8EL6azOkQ=; b=lidvml900hH8Avhw1iFfdjq39Gjf+wb19CFUBfv3KviezRu9fhjsJ975KCje+KSIvdmBJh nVt7FmEC+mI8n7yQwiESEUpeuRFoEvkUYQnD6GmOiQW/OxzItmTtypgX6Q6ivNRUc84Sts pqgP9AF0UjsUwNAS32eetj7ladT+V9k= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PATCH V4 1/4] mm: add swappiness=max arg to memory.reclaim for only anon reclaim X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <519e12b9b1f8c31a01e228c8b4b91a2419684f77.1745225696.git.hezhongkun.hzk@bytedance.com> Date: Mon, 21 Apr 2025 17:34:50 +0800 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-Transfer-Encoding: quoted-printable Message-Id: <972CD38C-9084-4CC0-8AD7-127745CACCDF@linux.dev> References: <519e12b9b1f8c31a01e228c8b4b91a2419684f77.1745225696.git.hezhongkun.hzk@bytedance.com> To: Zhongkun He X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Queue-Id: 3A8FC120011 X-Rspamd-Server: rspam04 X-Stat-Signature: 63xykf8hh1958uhnpxdoc1ij1fp5zfur X-HE-Tag: 1745228129-235062 X-HE-Meta: U2FsdGVkX18rIAmH87YZdDNuGLoccZi1pfiXG6BfPKj7lx4xm+PmfkqRjiPciaXrX06DaCi14bjISay0oic7ilpHBv30f0xPpYnlCFi8Dl6rZ7w6CsihHzDDHTyIetpjTT7AdqBrxwtrE2iA0PXMV3VMOzjKV5A+ok1gRQ84Yljb4DL4Ead5mcOZvZmBXHi3gpFp/o22suPc8nmXfNcg0Bi4V5c5RZSAUQHU7SbepzFUXNyiGZR3eeUGIjLJ9PfZ+kPMMv9XhS3u1QSZFz7O108qtp2tx0zDkBUkuEkr6kh1UN8BG6gu6PVBQBURHmXe20/NEH/fXvfoGYzoks4tymrhBgjKHHpz7+lnWi8COlfW+ZSSUG0ybeT8oYpP2aq/xl/awbdpFuoGRrFArECM7J5oFMa/r5+id7na+8VP+Ktx/wr9Cbnww3/MbGovl7RgpeNPDSWmEqR3u8Hxa23Bj2ccUL2d8VauCURxSh/3vAPKI8LeygCr5tLzHhWGSKk0p5C66Sd/zroFA1pxjtJZb+cZBGTMmhEupld2ROJrF8XiMMyUdpVZoRo1+khlFE1PWsg4JTVB9+n9BvDEL6wVmdQ2QpKelO2KgibVYu2nLBHoZJRpj6qUsEbwtzyFM8YfTHSz2lXjD8Iy0znQvp+mDn/3VIveVzMnsKWRfC0WHiFee51oceqHD8u8mhqQ0p2YROUbg+E0+TRYark1JHYPlJxbykEI0UmYEQ65SZOb+cgqcKrK/7xVUUUslayVWMLpuE2rX7DFtmhDUBjB12I+lbtDuyKZtU5ADBBZDUyRP68tj3q8yKTChKthkSUVLbwzzG3ZruGOe2U3RvXr3iblBVVy48Jm9EZvrgvrSGyKJ98RUwrEPoKmf/ZBghj3CgaM3PAh07Qs8DT5yD2ApsjZwWnJINB7NLQvJCpA3wr84NSWWEV9yqoCYGElfiWPXKvhcdQZcKGNC059Cg49Cw0 8g/nREiN 01BMDZ/mM5+wC1fh5Ar87IOvZcre/sIemKvUtt8soj81G3PttX50u5Waju+ImA5tLidTJQ1xhad0RvRz71j9F5J8zKM+1mjxfErIH5LoXKSUxsV7RfQmIYg3Sk0B3XEiomEu9tUKQof6DTnRYNjl0/ARmHniPnY1RnCHRmc29eHAPFjeFhJhjbAlkRv1uAXagbJA6PkwHFWBvHYV6b1b7mnrdUuX5PWXSiIff1SN4WgLHsC6VH18h7OuA+m7X/dE6u3l1 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 Apr 21, 2025, at 17:13, 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. >=20 > 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. >=20 > For example, something like this: >=20 > 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.=20 >=20 > will perform reclaim on the rootcg with a swappiness setting of 'max' = (a > new mode) 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 or other file first logic 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 new > mode 'max', means reclaiming just from anonymous folios both in = traditional > LRU and MGLRU. >=20 > Here is the previous discussion: > = https://lore.kernel.org/all/20250314033350.1156370-1-hezhongkun.hzk@byteda= nce.com/ > = https://lore.kernel.org/all/20250312094337.2296278-1-hezhongkun.hzk@byteda= nce.com/ > = https://lore.kernel.org/all/20250318135330.3358345-1-hezhongkun.hzk@byteda= nce.com/ >=20 > Suggested-by: Yosry Ahmed > Signed-off-by: Zhongkun He Acked-by: Muchun Song Thanks.=