From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CA76606A31C for ; Mon, 30 Nov 2026 00:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=NWJw1SGo Received: by kanga.kvack.org (Postfix) id 617606B05B0; Sun, 29 Nov 2026 19:15:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 599376B05B4; Sun, 29 Nov 2026 19:15:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 39C8B6B05B2; Sun, 29 Nov 2026 19:15:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 0289C6B05B1 for ; Sun, 29 Nov 2026 19:15:42 -0500 (EST) Received: from smtpin18.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7D637808AD for ; Mon, 30 Nov 2026 00:15:42 +0000 (UTC) X-FDA: 85489866924.18.3984C66 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf03.hostedemail.com (Postfix) with ESMTP id E08512000F for ; Mon, 30 Nov 2026 00:15:40 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=NWJw1SGo; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of sj@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1795997741; b=WKqNaU1G4Z2/TlV5oPR/Sbaj+w/6GSki08haXWX+Nq0t05KJkPbTTjyrBLpjvvgXspDGUs iOYAEMFArFYCjl0BasWmhVlg2/wiqoh+JkOBl/M38CZPt/EMno7K7HJCFzcSeQ8Gxg50du 8bkIVBqPA9SDQImAP8nMNSK/QUG7Cmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1795997741; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GycrmzdAflXX/LqLPke3TjBOHeS+/6MUeeaorLMX9xs=; b=Mu+JOnHZfOQN3GztiODhj2TmiAytwWl8iD7BjvhxY0QGV2ZKJ6YwqeUMJQwfPlh8HLdT4N Z9XQnrBxiCwO1dN6mT6Y9UCzqzeoKwFOtgzBwxs9w6XQ19lPNYGxbeLEQ9/PlAylAWxvY2 s4upt3OwDXanU02obGEmV9d6r4tokYo= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=NWJw1SGo; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf03.hostedemail.com: domain of sj@kernel.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=sj@kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id A4D6861344; Mon, 30 Nov 2026 00:15:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DD4B1F000C1; Mon, 30 Nov 2026 00:15:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795997739; bh=GycrmzdAflXX/LqLPke3TjBOHeS+/6MUeeaorLMX9xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NWJw1SGo0FMdf/Zx5oTUaIv8JsTcMs2I6RxlbxzIrELJXwYoK2wMGXuSYPhEAtx7X WSPhzd/fafBeWrMNxqYekgCFM3543dJADucdC7339EDp7GF1+YzuA9gDt74wHMZzAO kLs36y96/VFD1bZEb+IiikDLYEdHZDm0bM2JZtzMb11S1ViarojXcEYJCfJJZD7j5W Nkvgd9uqnbSodO/O+mGs7+VZ6nTk2zAG9pP/XnMfxBEZE6i86hUUCX9VxOfCUxD4mv BjKTPaZ5v1Ic1UBwT3ydjb6sf20wOJi/0tzD+uItSAptIJonMuC32/ktCM0MkZrJ5v CawgL3wRftORA== From: SJ Park To: Cc: SJ Park , Andrew Morton , damon@lists.linux.dev, linux-mm@kvack.org Subject: [RFC PATCH 2/2] mm/damon/ops-common: use probe hits weighted sum for hotness Date: Sun, 29 Nov 2026 16:15:29 -0800 Message-ID: <20261130001530.173703-3-sj@kernel.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130001530.173703-1-sj@kernel.org> References: <20261130001530.173703-1-sj@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: dsdbd3frkecc4b7t575undua6edab76w X-Rspamd-Queue-Id: E08512000F X-Rspam-User: X-Rspamd-Server: rspam03 X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1795997740-389642 X-HE-Meta: U2FsdGVkX19lRNbqb28NX6NH4qr/Biq0IBjAWfkw/MebrfhFsTy/H/5/OUAZlvTgLYwgD4VxdtBcoT34QCYsqfxmdDosqJL231OlpdzFpZ7DWn/CFpdv5P9ppyM9oAcHsGxIUhhThejbxClrztpBCKfTjS0VZ1vj+8tnaiV+JWNRMyv7/TqfHI+ex9K+LaOi0kMP9zHbqoIeXa5FvfjMDc13jovVxYm3Nnc8EsHk/YPq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aM6LYM/E13w7Iq6WJKn9H3myVifJ8Fq4ERVDXJIr30J+9wy+JZiqKVI04vjqwy8LnyLzFGNIiZt7ANO3v5IuHfLQL9ZNFCnG3/IfImtM/luSTpg9tNzZakIMRoWqfeleNJwOIE= Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 DAMOS finds memory that is eligible to apply the action, using DAMOS core filters and target access pattern. If the total amount of the eligible memory is larger than DAMOS quota, DAMOS selects memory to apply the action based on their hotness and the action type. For migrate_hot action, warmer regions are selected. For migrate_cold action, colder regions are selected. The hotness is calculated using the age and the access frequency. The frequency is counted in damon_region->nr_accesses. When DAMON is configured with data attribute probes and probe weights, it runs in attributes-only monitoring mode. In the mode, the traditional access frequency monitoring is skipped and therefore the access frequency counter is not updated. The prioritization logic will show all regions as having zero access frequency. For actions that prefer hot regions such as migrate_hot, regions of shorter age will be prioritized. For actions that prefer cold regions such as migrate_cold and pageout, regions of longer age will be prioritized. No real access frequency or the attributes monitoring results are considered. It is only chaotic and useless. In the attribute-only mode, probe hits weighted sum plays the role that is similar to that of the traditional access frequency. The adaptive region adjustment logic uses it in the attributes only mode. Do the same for the DAMOS quota region prioritization purpose hotness calculation. Replace the access frequency with the probe hits weighted sum for the hotness calculation in the mode. Signed-off-by: SJ Park --- mm/damon/ops-common.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c index 2216a0023154..9197ead1c96b 100644 --- a/mm/damon/ops-common.c +++ b/mm/damon/ops-common.c @@ -168,6 +168,7 @@ void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm, int damon_hot_score(struct damon_ctx *c, struct damon_region *r, struct damos *s) { + unsigned int nr_events; int freq_subscore; u64 age_in_sec; int age_in_log, age_subscore; @@ -175,8 +176,12 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r, unsigned int age_weight = s->quota.weight_age; int hotness; - freq_subscore = mult_frac(damon_nr_accesses_mvsum(r, c), - DAMON_MAX_SUBSCORE, + if (damon_has_probe_weights(c)) + nr_events = damon_probe_hits_wsum(r, false, true, c); + else + nr_events = damon_nr_accesses_mvsum(r, c); + + freq_subscore = mult_frac(nr_events, DAMON_MAX_SUBSCORE, damon_nr_samples_per_aggr(&c->attrs)); age_in_sec = div_u64((u64)r->age * c->attrs.aggr_interval, -- 2.47.3