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 5A15BC83F1A for ; Thu, 17 Jul 2025 22:28:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC8038D0006; Thu, 17 Jul 2025 18:28:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E51218D0001; Thu, 17 Jul 2025 18:28:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D47788D0006; Thu, 17 Jul 2025 18:28:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id BF3448D0001 for ; Thu, 17 Jul 2025 18:28:26 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 47B6D10E6C3 for ; Thu, 17 Jul 2025 22:28:26 +0000 (UTC) X-FDA: 83675196612.18.8142EDC Received: from out-185.mta0.migadu.com (out-185.mta0.migadu.com [91.218.175.185]) by imf29.hostedemail.com (Postfix) with ESMTP id 755F3120006 for ; Thu, 17 Jul 2025 22:28:24 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=sh3QseuT; spf=pass (imf29.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.185 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1752791304; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Zh/7SvM91qR9TIyz9SW2o/sNWa9jLbdEppcVWn32jKo=; b=Z0A0zhAqHx9G0iNytY6dGQ8GL8C0R1OYUkSSKHAXOcEjhSYgBv7mkKWGjsczUApbaMPPdk FgLWdhc2JOLVlyvWRi7X02vN027qCTDmqE+qSVejjuW2wSssqiKLNs3QOYsZ0jSUiYEvgW Df12gODJmnZZu90fwWKIHHM71M394Y0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=sh3QseuT; spf=pass (imf29.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.185 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1752791304; a=rsa-sha256; cv=none; b=HzY1jyezoL49UYvP8M8lezAWbBaPQ7EiuKYIkPzUJ1XzQCBiHKI5JRnB7MBa0P2ya+FGb5 mT8KYOrFYUALFpIvuKQ9OzYNBbPLmGGVJKRb0px9zxqwhTFgvNjDz6U+m/eBDYo02jXWun giHvSCyUe1Hh8tyeGho0tTyeGEgOA90= Date: Thu, 17 Jul 2025 15:28:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1752791301; 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: in-reply-to:in-reply-to:references:references; bh=Zh/7SvM91qR9TIyz9SW2o/sNWa9jLbdEppcVWn32jKo=; b=sh3QseuTc8ReToJ3keoCgDR0PR/3rgRLKUOVpi5CEdMIp9i9ELULiCypr8sMVSd3PSW4Ze Bpd9xZsRn3/onTH99B/PapI6OfekxlNykKI30hmN7VFtdr2as0/mRsrDUPq072FcaAj8Sx dUqeOi8cksTmaWshphj0OV83TI+qC+s= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Davidlohr Bueso Cc: akpm@linux-foundation.org, mhocko@kernel.org, hannes@cmpxchg.org, roman.gushchin@linux.dev, yosryahmed@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] mm: introduce per-node proactive reclaim interface Message-ID: <6utnw5xyyjqo7o3bsn3s2vp5hfl7ujt4hiyluodhdw4mmzgr22@4vxkkw2kb57y> References: <20250623185851.830632-1-dave@stgolabs.net> <20250623185851.830632-5-dave@stgolabs.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250623185851.830632-5-dave@stgolabs.net> X-Migadu-Flow: FLOW_OUT X-Rspam-User: X-Rspamd-Queue-Id: 755F3120006 X-Rspamd-Server: rspam06 X-Stat-Signature: 4kqfdmt7g4i1xytfj1hyi6ojyhew9bjf X-HE-Tag: 1752791304-787054 X-HE-Meta: U2FsdGVkX18AUGDZARf1JEByb0WkDxMFlta9sMiD5K3SwcPvjLf18BfBwyWs9ixa3vnlTl9LWWHWJ9qiUI12hQxX6hb090l88h+KpY3Gck54u4U77JtCSnDbQnKMMLKrj48XEIY/u7PBOBs4LXeD2KDGhalBxzQ5ZWNwVmRR1VswsrHgSLI5OSD22kbPC8VjhAcyZxFD7iENLInrfAN5jOCx/us/EH+aXZeD9L4ZQ0OvuIQrVA+8sH08AG4oE+X0bgud6FQkVFGUpMTL5nJcXnAseDl3Vive+bmROD+eIn7YdMDRGyoikIwToDVxyAF7FYxpuRfqanovlzHbksQK7quqVFTN4zbgpz2nW93o2TlJNcyJl+lbuQ90yKc2TrfH5OWJwZ3rx3jh7JSxDapEAlz6DiqyKpJBO2jYv4X20FMViDJoEmVclLHwQ3iNiKRDRgs/L1dzu1e8moRsocNVANJtAekKWAE4J9TrLa30B/fpxf6AmupeIDLAgCTBklLz/eWcdfbflPXjJqDwIrXWYeIDa5FW08/A/qi777TaZK4OsOAGMaQhjIW5CtzaLRm9XpnqYosDS3XQZs1NaFHNiPc2FYBd1Q/jPSVfvjy9tNByft30UuwTh+rwsG3DKiTOgcdH7Pz7KSqSBNv48jVJ/2Uh4RK96FCUJ/e80i3DEkyA/+152+n9+4RoaLjCWw2luwCUJypbhfF+Xkbh8eoM/YrAB1BZd5gbc1B/KFTGBsSXoNfRoP2IJxztTYQM3JhZY/M4VBtkmcxkdwC4GqoXWbYKPK1Oh+H3gePbrkIlAxchmHTv7vOKSHWnMXKVOv1dO7AHQ2HpEyvbZ+BOZ8bd8KoKUqp5KP5aV+nlwg23YfyEioBfNCE4Mc3/Vo0AOIhzt604vQZV6ExC3pZMj6uYsuB+2PKVsLRZRFYuOJhnj+I1iufI/TzTg6qA0DFMw2FNvExojtRQ0soaaJ7dNaF cbEnn2VS YiIJj4Ydap9aMnhJgmJrKx2Jc/8zoEYERcdwANHn9DvN1wR3YlgWSogU5f06rCZFF32sqeKzXbiY8EsmxHS4PbORvl8X3cwETJAFF+PkuJQvSwRnYwCLLgsLDTBpe7jYx/znv9vh5OZA68stx9sMB0TFmpijvg8s1dc3gaZtb8FKQo5wkGgRCh8H6rz05Inf6VfTf4DUU8liJsuYmSfPWxm8N5xK9jISyqY3JRBRb7g8dDPBCA7pO84rs94ai/busT6fhrrKEzNOnu34niCTUadIEwQ== 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, Jun 23, 2025 at 11:58:51AM -0700, Davidlohr Bueso wrote: > This adds support for allowing proactive reclaim in general on a > NUMA system. A per-node interface extends support for beyond a > memcg-specific interface, respecting the current semantics of > memory.reclaim: respecting aging LRU and not supporting > artificially triggering eviction on nodes belonging to non-bottom > tiers. > > This patch allows userspace to do: > > echo "512M swappiness=10" > /sys/devices/system/node/nodeX/reclaim > > One of the premises for this is to semantically align as best as > possible with memory.reclaim. During a brief time memcg did > support nodemask until 55ab834a86a9 (Revert "mm: add nodes= > arg to memory.reclaim"), for which semantics around reclaim > (eviction) vs demotion were not clear, rendering charging > expectations to be broken. > > With this approach: > > 1. Users who do not use memcg can benefit from proactive reclaim. > The memcg interface is not NUMA aware and there are usecases that > are focusing on NUMA balancing rather than workload memory footprint. > > 2. Proactive reclaim on top tiers will trigger demotion, for which > memory is still byte-addressable. Reclaiming on the bottom nodes > will trigger evicting to swap (the traditional sense of reclaim). > This follows the semantics of what is today part of the aging process > on tiered memory, mirroring what every other form of reclaim does > (reactive and memcg proactive reclaim). Furthermore per-node proactive > reclaim is not as susceptible to the memcg charging problem mentioned > above. > > 3. Unlike the nodes= arg, this interface avoids confusing semantics, > such as what exactly the user wants when mixing top-tier and low-tier > nodes in the nodemask. Further per-node interface is less exposed to > "free up memory in my container" usecases, where eviction is intended. > > 4. Users that *really* want to free up memory can use proactive reclaim > on nodes knowingly to be on the bottom tiers to force eviction in a > natural way - higher access latencies are still better than swap. > If compelled, while no guarantees and perhaps not worth the effort, > users could also also potentially follow a ladder-like approach to > eventually free up the memory. Alternatively, perhaps an 'evict' option > could be added to the parameters for both memory.reclaim and per-node > interfaces to force this action unconditionally. > > Signed-off-by: Davidlohr Bueso After Roman's suggestion, you can add: Acked-by: Shakeel Butt