From nobody Fri Apr 3 20:51:50 2026 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52D9B38645B for ; Mon, 23 Mar 2026 09:39:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774258744; cv=none; b=QAnQfbu4oLcObxQiY+dUNK1Kw2tKwo0YAZtcosK9mBN0h8XzTSVZtRq3O0ltCQApNI2pNEy/CdzQqsz8q0yYijndvAo2cUSOqDShQNORfwu0qC8USGHcPwvgwQ7BsRtrtzb0A5YeQDj6uBicg8NjXSQBhrEfDypdeATHE3REnsM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774258744; c=relaxed/simple; bh=kx8TB2AAlwopU7G/ZfMkXth/4MyX6tResq9YxxvtpHg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=O+jx+ruhu8O7hUGWfOh7Mh0L3ur+RiGoi9PCIBWPTxNLieJgCZqfPYlYumrHfwh9JkhP5t/4519Cmx2w4HgQmxJUKZU0UJT4bkcX/9Uj3iTnHAVKGWiFPqaBbQsF0EJAH7GW3Qz8iau+3RVzlQhROEXZqMHZwm9SB0c2qQmnll0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=rK5tnbcD; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="rK5tnbcD" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62MBxw0l3556089; Mon, 23 Mar 2026 09:38:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=pp1; bh=FrpeyILK0ENmphnVW0EZaBCf4uaQTSWsxG6M7lM7Y JQ=; b=rK5tnbcD1XsxX4nJnFJAEw2rb01jIsVi7VR+XpEjF5SHBGZU2mVdp6Ild Xedn1vFX6uSHzVZR5gEVkOaxqX+gjrkphLVM8hi/YgWD5FC0RgON91KtjxGAUBrO jFIHxx8Un+0VoNvPvkf3v/yHO6LiBnoQObWjZbe7Lrd/J6BcOlPsEz9D58JGklJi 4aaUyvRNAlnhViAPE2v9/NY0OSZxDLqGoHQHeCBR0a4NgFW/ztIYEq2H6CJDBzve dNtzG7ZMF0USb3brrfbTmMtw9XrGPi4QOx6eBWpG/Li2haZvN9sAcrCkOEWCDB5E 6hwwqAmwmRCT7PNHw2RfSorYsJu4Q== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4d1kumdydg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 09:38:46 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 62N8ntjB004387; Mon, 23 Mar 2026 09:38:45 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4d28c1vhyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Mar 2026 09:38:45 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 62N9chNh51183914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 23 Mar 2026 09:38:44 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D650520043; Mon, 23 Mar 2026 09:38:43 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7FAC20040; Mon, 23 Mar 2026 09:38:41 +0000 (GMT) Received: from ltczz402-lp1.aus.stglabs.ibm.com (unknown [9.5.7.39]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 23 Mar 2026 09:38:41 +0000 (GMT) From: Donet Tom To: David Hildenbrand , Andrew Morton , Ingo Molnar , Peter Zijlstra Cc: Ritesh Harjani , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Baolin Wang , Ying Huang , Juri Lelli , Mel Gorman , Donet Tom Subject: [PATCH v2] memory tiering: Do not allow promotion if NUMA_BALANCING_MEMORY_TIERING is disabled Date: Mon, 23 Mar 2026 04:48:49 -0500 Message-ID: <20260323094849.3903-1-donettom@linux.ibm.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: YhatTrWyUVC7CbINhBnzn3MhOaw8FOAv X-Proofpoint-ORIG-GUID: jwABisIW9S4xwDLhWOiqrNHnbGO6tMt8 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIzMDA3MSBTYWx0ZWRfXy6a1k2bOriWK 97kXvapesY0kHE+7oYb4XC/qsn0DiEzXjDRsqMBPF6tVcZNKXsZ3XNYDkhlHBdM/xrAaOlS7d2x Zd+qz3TqkgPdRGCbThqP2quywtQlErAlPZSwomslAIEfY1L8EoorQ/PBYCep5ycbNZPoI6J567W hnEGc5HEfwe3h6HqAVEv65DL7gWj2ZY8pcO/XZlC87Pra2zvm3+Xz6ORfYtoIakXSFHIJB8RcPr TNeNYGW9u33ql8EYYxC1qjybActRkw08YzfCXSG4pLaTgqifaU+mv2H9cvTOVGoMkid3Epz8rs7 XA2v3sGm/aclKazOweZd/L1eRx06+TVILNvx4aDNj/Lxb5QwQbwV7s1y5NqVinuK3mppa2CXW5g gnevMDA1JkD2U0n9FBCznPNO9c8+oA0HxQwAPp7MReck3hbPYAFJlonARxpPK2lJBBlfoFg/Il8 p533qi8g/Kwhjzt778g== X-Authority-Analysis: v=2.4 cv=KbXfcAYD c=1 sm=1 tr=0 ts=69c10a26 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=RzCfie-kr_QcCd8fBx8p:22 a=VwQbUJbxAAAA:8 a=VnNF1IyMAAAA:8 a=z67VAb8CozsjbE2CDLsA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-23_02,2026-03-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 malwarescore=0 adultscore=0 clxscore=1015 priorityscore=1501 bulkscore=0 lowpriorityscore=0 phishscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603230071 Content-Type: text/plain; charset="utf-8" In the current implementation, if NUMA_BALANCING_MEMORY_TIERING is disabled and the pages are on the lower tier, the pages may still be promoted. This happens because task_numa_work() updates the last_cpupid field to record the last access time only when NUMA_BALANCING_MEMORY_TIERING is enabled and the folio is on the lower tier. If NUMA_BALANCING_MEMORY_TIERING is disabled, the last_cpupid field can retains a valid last CPU id. In should_numa_migrate_memory(), the decision checks whether NUMA_BALANCING_MEMORY_TIERING is disabled, the folio is on the lower tier, and last_cpupid is invalid. However, the last_cpupid can be valid when NUMA_BALANCING_MEMORY_TIERING is disabled, the condition evaluates to false and migration is allowed. This patch prevents promotion when NUMA_BALANCING_MEMORY_TIERING is disabled and the folio is on the lower tier. Behavior before this change: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D - If NUMA_BALANCING_NORMAL is enabled, migration occurs between nodes within the same memory tier, and promotion from lower tier to higher tier may also happen. - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from lower tier to higher tier nodes is allowed. Behavior after this change: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D - If NUMA_BALANCING_NORMAL is enabled, migration will occur only between nodes within the same memory tier. - If NUMA_BALANCING_MEMORY_TIERING is enabled, promotion from lower tier to higher tier nodes will be allowed. - If both NUMA_BALANCING_MEMORY_TIERING and NUMA_BALANCING_NORMAL are enabled, both migration (same tier) and promotion (cross tier) are allowed. Fixes: 33024536bafd ("memory tiering: hot page selection with hint page fau= lt latency") Signed-off-by: Donet Tom --- v1 -> v2 =3D=3D=3D=3D=3D=3D=3D=3D 1. Dropped changes in task_numa_fault() since the original changes already handle runtime disabling of NUMA_BALANCING_MEMORY_TIERING. v1 -> https://lore.kernel.org/all/20260320092251.1290207-1-donettom@linux.i= bm.com/ --- kernel/sched/fair.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bf948db905ed..4b43809a3fb1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2024,8 +2024,12 @@ bool should_numa_migrate_memory(struct task_struct *= p, struct folio *folio, this_cpupid =3D cpu_pid_to_cpupid(dst_cpu, current->pid); last_cpupid =3D folio_xchg_last_cpupid(folio, this_cpupid); =20 + /* + * Do not allow promotion if NUMA_BALANCING_MEMORY_TIERING is disabled + * and the pages are on the lower tier. + */ if (!(sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) && - !node_is_toptier(src_nid) && !cpupid_valid(last_cpupid)) + !node_is_toptier(src_nid)) return false; =20 /* --=20 2.47.1