Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp142568lqs; Thu, 13 Jun 2024 06:24:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3+NX86y4wTHfilMJzK3i3+pvVdUA9bjOxxO9+5Xk5ty9JccBhm34n4e3K/FGokFhgCGUi7hO+gRcxVsBTXCt9Xf4VOW+8TU0tQjqb9g== X-Google-Smtp-Source: AGHT+IGoKd3LVfdM5lYag+5xx4f+aGW1QW6bBpJN1BrzWzINdrGsu+JIaGpJeeg6Z57V+7IlXLCO X-Received: by 2002:a05:6a00:650e:b0:705:9b04:728 with SMTP id d2e1a72fcca58-705bceb11abmr4672975b3a.24.1718285099325; Thu, 13 Jun 2024 06:24:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718285099; cv=pass; d=google.com; s=arc-20160816; b=d01ayW9pxt1iM5KGlflDQP59RQrY08IL3Ug3UXBVw09ub11cPjCSlhKxfdQuRlU+N5 v4gUQT8PO0PHxC5ea0D/kKNujyK8QaZbf4yJMtWF9MYaXu7XUM+3QD5Mo0vz1rpFkqDk BkFq40zeOLjIWZB6IazQl52wIOk0Y237vvR7qH149/UN+PCr04oUe89dp6qoYLsGyxmi tVlHGW8RPWOdvjHF0XUCYflEF94wTPvX3jdlAkUYhz0ay3Ar5rHFhOG2RGgLkS+BXS3+ eE2eQKyXlZ6VROIYaYiv7FRNyRanix0P3wziE5Up9n1djNbTbHjIguM7aNBxvHQ9ubjN 32Fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=W+wH/UsDXMYVoEv5VVlhskRzuD9gwWhPNWSfnhG7wLQ=; fh=7YaiENL1tezcIJq0/3sgBzPZui5kQKZGq25XH8SZkKo=; b=hl+2X2V3XtAVeRFjtiIzOsFHVX1Ez+8WFvTZ6w/q9Kqqba2/h8WpCjavhJOBud6zQ2 IQLuZiANHfpwzSpzuiA4wy+nhqnyJB3MKLyNABx1TqeqiQi08QzQWHcpCkBgxQqkuZtf eEP/+8f7BfdIDVk0A2FOxpbOUXhEjnCT4QCwkInz89uhAusH46fYt+YqFbSOPX3TQtUD 32CPe8tWfdvuhVwEtLsmP3vfhXVVxgomqWaNmbn736G3SckMLazR3NgJgvjLF5UuNFYI 7QXAHLoTMlCdGkllo9g7SM8hV5q/2d/tNY08+/iCCNkhypBFQ6JGY3q4YLUlqowTYQGi WYZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-213296-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213296-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fee558c960si1337986a12.706.2024.06.13.06.24.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 06:24:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213296-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-213296-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213296-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E4AA8284DD4 for ; Thu, 13 Jun 2024 13:23:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6102146586; Thu, 13 Jun 2024 13:21:20 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC4E1145343; Thu, 13 Jun 2024 13:21:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718284880; cv=none; b=ll1jaWX3fFlJHAJswPb52U1FzbUE/9N2tlhAiKlRNJhgxlb1gO1U/3TQfhQfKWJ+IY1ZVKv3EFQqL7kGjWKNOMsrHZs+sqoFnLRlVuuPfmAUfIKYdw+lFSX0m66ANVKxcnJZ3/P0UMP0Gnc7aJfawAnYkYPFu1YzEEGiEz+DhEQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718284880; c=relaxed/simple; bh=/fG6BOMu3pDqWuzCvSk+FHfqzO4oGlow/E9AiQiJ9Bs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a4GemkJKqyWBANvxbIHBtH0YjkNTX+ODlL+D+o0ZfL8yT2Os8K8vyGRWu8+f4YEcsKc3ikBykkmdRH+doohKVADzadUSHFLymZQApNcikY0H3SyVp3GCZES1gSXZQ1PMmMba42UzKAS955RjrtYb0D/+QG9IlShO5M6XQFZiQUM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-52-666af24bc2a6 From: Honggyu Kim To: SeongJae Park , damon@lists.linux.dev Cc: Andrew Morton , Masami Hiramatsu , Mathieu Desnoyers , Steven Rostedt , Gregory Price , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, 42.hyeyoo@gmail.com, art.jeongseob@gmail.com, kernel_team@skhynix.com, Hyeongtak Ji , Honggyu Kim Subject: [PATCH v5 6/8] mm/damon/paddr: introduce DAMOS_MIGRATE_HOT action for promotion Date: Thu, 13 Jun 2024 22:20:53 +0900 Message-ID: <20240613132056.608-7-honggyu.kim@sk.com> X-Mailer: git-send-email 2.43.0.windows.1 In-Reply-To: <20240613132056.608-1-honggyu.kim@sk.com> References: <20240613132056.608-1-honggyu.kim@sk.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRmVeSWpSXmKPExsXC9ZZnoa73p6w0g3knxCwm9hhYzFm/hs3i /oPX7BZP/v9mtWhoesRicXnXHDaLe2v+s1ocWX+WxWLz2TPMFouXq1ns63jAZHH46xsmBx6P paffsHnsnHWX3aNl3y12j02rOtk8Nn2axO5xYsZvFo8Xm2cyemz8+J/d4/MmuQDOKC6blNSc zLLUIn27BK6MnUefshbsk6i4sPgsawNjp0gXIyeHhICJxKXF81lh7MM3V4PZbAJqEldeTmLq YuTgEBGwkpi2I7aLkYuDWeAas8Tu7pPMIDXCAhES0zqmgdWzCKhKrDn/AMzmFTCV2LF9NRPE TE2Jx9t/soPYnAJmEo/mvmIDsYWAamb8uMoMUS8ocXLmExYQm1lAXqJ562xmkGUSAu/ZJK5c n8UIMUhS4uCKGywTGPlnIemZhaRnASPTKkahzLyy3MTMHBO9jMq8zAq95PzcTYzAKFhW+yd6 B+OnC8GHGAU4GJV4eD2eZaUJsSaWFVfmHmKU4GBWEuGdtRAoxJuSWFmVWpQfX1Sak1p8iFGa g0VJnNfoW3mK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MCAAA= X-CFilter-Loop: Reflected From: Hyeongtak Ji This patch introduces DAMOS_MIGRATE_HOT action, which is similar to DAMOS_MIGRATE_COLD, but proritizes hot pages. It migrates pages inside the given region to the 'target_nid' NUMA node in the sysfs. Here is one of the example usage of this 'migrate_hot' action. $ cd /sys/kernel/mm/damon/admin/kdamonds/ $ cat contexts//schemes//action migrate_hot $ echo 0 > contexts//schemes//target_nid $ echo commit > state $ numactl -p 2 ./hot_cold 500M 600M & $ numastat -c -p hot_cold Per-node process memory usage (in MBs) PID Node 0 Node 1 Node 2 Total -------------- ------ ------ ------ ----- 701 (hot_cold) 501 0 601 1101 Signed-off-by: Hyeongtak Ji Signed-off-by: Honggyu Kim Signed-off-by: SeongJae Park --- include/linux/damon.h | 2 ++ mm/damon/paddr.c | 3 +++ mm/damon/sysfs-schemes.c | 1 + 3 files changed, 6 insertions(+) diff --git a/include/linux/damon.h b/include/linux/damon.h index 56714b6eb0d7..3d62d98d6359 100644 --- a/include/linux/damon.h +++ b/include/linux/damon.h @@ -105,6 +105,7 @@ struct damon_target { * @DAMOS_NOHUGEPAGE: Call ``madvise()`` for the region with MADV_NOHUGEPAGE. * @DAMOS_LRU_PRIO: Prioritize the region on its LRU lists. * @DAMOS_LRU_DEPRIO: Deprioritize the region on its LRU lists. + * @DAMOS_MIGRATE_HOT: Migrate the regions prioritizing warmer regions. * @DAMOS_MIGRATE_COLD: Migrate the regions prioritizing colder regions. * @DAMOS_STAT: Do nothing but count the stat. * @NR_DAMOS_ACTIONS: Total number of DAMOS actions @@ -123,6 +124,7 @@ enum damos_action { DAMOS_NOHUGEPAGE, DAMOS_LRU_PRIO, DAMOS_LRU_DEPRIO, + DAMOS_MIGRATE_HOT, DAMOS_MIGRATE_COLD, DAMOS_STAT, /* Do nothing but only record the stat */ NR_DAMOS_ACTIONS, diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c index 882ae54af829..af6aac388a43 100644 --- a/mm/damon/paddr.c +++ b/mm/damon/paddr.c @@ -486,6 +486,7 @@ static unsigned long damon_pa_apply_scheme(struct damon_ctx *ctx, return damon_pa_mark_accessed(r, scheme); case DAMOS_LRU_DEPRIO: return damon_pa_deactivate_pages(r, scheme); + case DAMOS_MIGRATE_HOT: case DAMOS_MIGRATE_COLD: return damon_pa_migrate(r, scheme); case DAMOS_STAT: @@ -508,6 +509,8 @@ static int damon_pa_scheme_score(struct damon_ctx *context, return damon_hot_score(context, r, scheme); case DAMOS_LRU_DEPRIO: return damon_cold_score(context, r, scheme); + case DAMOS_MIGRATE_HOT: + return damon_hot_score(context, r, scheme); case DAMOS_MIGRATE_COLD: return damon_cold_score(context, r, scheme); default: diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c index 880015d5b5ea..66fccfa776d7 100644 --- a/mm/damon/sysfs-schemes.c +++ b/mm/damon/sysfs-schemes.c @@ -1458,6 +1458,7 @@ static const char * const damon_sysfs_damos_action_strs[] = { "nohugepage", "lru_prio", "lru_deprio", + "migrate_hot", "migrate_cold", "stat", }; -- 2.34.1