From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yx1-f68.google.com (mail-yx1-f68.google.com [74.125.224.68]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A575324716 for ; Fri, 20 Mar 2026 19:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.224.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774033502; cv=none; b=UqU5a9NRQfJJbL4j2tG+vBV93PEYMKHaCkrS8aNc4Nl4PXPXjvg247yOZkjoWxpdcpD+b+IBuWRe4gju/lvk+qq/Y8CYG0imQb0CfXzxFQ9qVdNzoxaCsB3meeSfM0iXoNCGiRMyXY+6GEs+uTUtiDb9yB9mKV0M6wiw9mFQX8g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774033502; c=relaxed/simple; bh=38WZSCo5lv+k+5ZznusrVk4MfUht3WxQ2DgEfRCxPzM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DfutUjTsygXUn8GA2ABIYRop41kzVPrPOp1F01TeA6N99YiZd8ev7qDCpHFEFE4iPW05od4rtRwPO3QAtgsmU89bFsPnQZKgDddx7vs0iAx+jZDz4+jijp5zw5kY/WHjDh88Fbkrm92EtyBiYLWD53cJim3Nvz1UGod8DHebCq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lKmfLGxq; arc=none smtp.client-ip=74.125.224.68 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lKmfLGxq" Received: by mail-yx1-f68.google.com with SMTP id 956f58d0204a3-64ca6595c8aso868121d50.0 for ; Fri, 20 Mar 2026 12:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774033499; x=1774638299; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=hrbpczjmQlWdU+8xGkQY54294j65e0aZRYcB8uO4mU0=; b=lKmfLGxqGbqGS4cUvrD8wZtX7HAtlA/xRgPcsujtfaaP4RocH4HklhMV9CLabMdID4 W+Gl3Dk/EjLETEvo9EqcCuvYNB11Bp6n3wMe+1sS+rID96n/iP/PIhKyAZzjhQ5qutzy GNtPwb6ixJxvQGu6MVmLRPRQd1gJ4OmgYTXKsfDnD13judtzUP2BB5qz8yX1AqkSszGh CbJlSQI2N9dUBQMWPeGy7Y5GZlGcCjB1gGmgLQ8C9bNrPsnKBX7UC77jCz0r6YE0PiiT eJUqckgJmoh/DwkgUlz582nb0Q7thnO24SWX1xWopFY21a6XFCURKRAMUgYgUf6C0XwE cFdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774033499; x=1774638299; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hrbpczjmQlWdU+8xGkQY54294j65e0aZRYcB8uO4mU0=; b=o26+URjizKzAv9EUVptzArp/BUOB5/4LLxXLP5k4NVigjYOwXNJXDlkVte7YwZqVQW mPXXtxy3XrALf5WFZ3u1b2VaiUPG8S6NFQxYjnnH1wDvrzSV7n/L9MnGc/3r6kOsdpDa DOCkjmbumd4UQTAXrlM3tBxmVRSYJXzfUIB9SQgcLZOA+hEZJAsKW1TlYu2F0FFhfyGC z4QsEhvobqtPc3kpSh4DtfhWD6graCYrkqccW8Clx4zNkvo0zVsqSPUlAV3jo1yt6PzR WKLqFZU7g3P8EYhHMIZppmg6tysu1xnEyCeReWHwJ1A0gxS+9qbaLqhFrAYTXvXa0qmj ahfw== X-Forwarded-Encrypted: i=1; AJvYcCV4yDFbLiK83oiD93UNzn+PUmiDFwRoQNvZNwI6ieTHYDAIJSRm95P5W7icZH1Z93iYSr/USer5ni2Qc44=@vger.kernel.org X-Gm-Message-State: AOJu0YxXRfN9YS0nEinrA+/RmhSmC0Ubi0/bocwzfGYf2JOTSdo01ZxW 82G6fuQ/uwiqPlLDXxkTK5hqSb9oFn/WFuXBcQ1RR1AKF0Uc7xVlOiA= X-Gm-Gg: ATEYQzxjkFoDIiKNCId06x4Knj3zmZUUSBaOW1+S9L3hNliSOBk2nJHjXaS2ZXfaxii 3K7ISAflVyPsphdh+IUzkUdTnO13i3fm0HlsbiqJj09NdpMIM4fBMmVLazVgdM03Rn492u4H2IQ jfFR1G9RtJLfFDm6S5iaWl0kNaSakdNwi7DygOFQEp5ZvX3jaEs8APFrjjlSplp35sNg6CHlGrO 6dEUCodsJUav1SCIqHJXP2DLD/j6fAM4tKcf9sf0nfIvCdQ875a1RgaN+XhdvxeJsUdfGyVnLil x+FD6cFHNm0NyTiIz3FGqKMEittQiIqiMgkt9/es0kXRxTIuO2YZ9/z+GiTjrO24QSV4wPMYa6P AKWP1KwKuMVmIUEe0ayMcw0b8lQeGSSDltUc2OhxcH3mP0uK4JuZHrUDVNIUWta87fhp0jj7pbC KR1mteE0LG94O7Hs6TJe6CKJGoFCQr8MVb8PeH3Vc9Od4BLUpv/EKxixkazHMPOHOD7W6Ewhk8Y A== X-Received: by 2002:a05:690e:16e4:b0:649:e501:21a6 with SMTP id 956f58d0204a3-64eaa6b8bdbmr3383035d50.16.1774033499004; Fri, 20 Mar 2026 12:04:59 -0700 (PDT) Received: from localhost (23-116-43-216.lightspeed.sntcca.sbcglobal.net. [23.116.43.216]) by smtp.gmail.com with ESMTPSA id 956f58d0204a3-64eabecf140sm1983409d50.17.2026.03.20.12.04.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2026 12:04:58 -0700 (PDT) From: Ravi Jonnalagadda To: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: akpm@linux-foundation.org, corbet@lwn.net, bijan311@gmail.com, ajayjoshi@micron.com, honggyu.kim@sk.com, yunjeong.mun@sk.com, ravis.opensrc@gmail.com Subject: [RFC PATCH v4 0/1] mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics Date: Fri, 20 Mar 2026 12:04:52 -0700 Message-ID: <20260320190453.1430-1-ravis.opensrc@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch introduces two new DAMON quota goal metrics for controlling memory distribution in heterogeneous memory systems (e.g., DRAM and CXL memory tiering) using physical address (PA) mode monitoring. v3: https://lore.kernel.org/linux-mm/20260223123232.12851-1-ravis.opensrc@gmail.com/ Changes since v3: ================= - The first two patches from v3 (goal_tuner initialization fix and esz=0 quota bypass fix) are now in damon/next. This submission contains only the core metrics patch, rebased on top of those fixes. - Simplified implementation: removed per-node eligible_bytes array, now iterates scheme-eligible regions directly for each goal evaluation. - Handle regions crossing node boundaries: uses damon_get_folio() to determine actual NUMA node placement of each folio rather than assuming uniform node placement within a region. - Pass scheme pointer directly to metric calculation functions, avoiding container_of() derivation from quota pointer. - Fixed 80-column wrapping issues. Background and Motivation ========================= In heterogeneous memory systems, controlling memory distribution across NUMA nodes is essential for performance optimization. This patch enables system-wide page distribution with target-state goals like "maintain 30% of scheme-eligible memory on CXL" using PA-mode DAMON schemes. What These Metrics Measure ========================== node_eligible_mem_bp: scheme_eligible_bytes_on_node / total_scheme_eligible_bytes * 10000 node_ineligible_mem_bp: (total - scheme_eligible_bytes_on_node) / total * 10000 The metrics are complementary: eligible_bp + ineligible_bp = 10000 bp. Two-Scheme Setup for Hot Page Distribution ========================================== For maintaining 30% of hot memory on CXL (node 1): PUSH scheme: migrate_hot from node 0 -> node 1 goal: node_ineligible_mem_bp, nid=0, target=3000 "Push hot pages out until 30% of hot memory is NOT on DRAM" PULL scheme: migrate_hot from node 1 -> node 0 goal: node_eligible_mem_bp, nid=0, target=7000 "Pull hot pages back until 70% of hot memory IS on DRAM" The complementary goals create a feedback loop that converges to the target distribution. Dependencies ============ This patch is based on SJ's damon/next branch which includes the TEMPORAL goal tuner required for these metrics. Testing Results =============== Functionally tested on a two-node heterogeneous memory system with DRAM (node 0) and CXL memory (node 1). Used PUSH+PULL scheme configuration with migrate_hot action to maintain a target hot memory ratio between the two tiers. With the TEMPORAL goal tuner, the system converges quickly to the target distribution. The tuner drives esz to maximum when under goal and to zero once the goal is met, forming a simple on/off feedback loop that stabilizes at the desired ratio. With the CONSIST tuner, the scheme still converges but more slowly, as it migrates and then throttles itself based on quota feedback. The time to reach the goal varies depending on workload intensity. Ravi Jonnalagadda (1): mm/damon: add node_eligible_mem_bp and node_ineligible_mem_bp goal metrics include/linux/damon.h | 6 ++ mm/damon/core.c | 158 ++++++++++++++++++++++++++++++++++++--- mm/damon/sysfs-schemes.c | 12 +++ 3 files changed, 164 insertions(+), 12 deletions(-) -- 2.43.0