From nobody Mon Feb 9 01:44:59 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (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 CBBD345C3A7 for ; Thu, 8 Jan 2026 10:16:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767867388; cv=none; b=rLPUAb4WiKX+41POFABgX8YeziSPeBWmBruJuKMblCYMwo6/5sHz7Mh0Xw1nDUCMyeEaC7OdwnaHl0vCqX1/35KQ8In45Ktt9pNvX1Xfc71Bit6PUJ6KA2RFc4+41ahXuy0zsIwDF9w8F+EMlWzTqUVtanIEj5IGiItTsYsmR90= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767867388; c=relaxed/simple; bh=uwpd6A8/JJiZRPsY0eYWPt+toE8mJr3sa3KvHSB6r6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uUmx6fcgXL3jt/tMcYtYiCLxWqA4m2pK6ZnNpu1H+P4vkiNmhI80N3VB9/2hEGNiNoVxG3O/mDVoUfEUm35d/47FSj9k6FzSOwWn3nPGUoGGsUOU+OB+KAGJgB1SIdZ+Yr5sCv5cRgUUbOpIbk8GjNL7C8IYQLBlFsaXI9FVf6I= 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=l11mSy+8; arc=none smtp.client-ip=209.85.210.170 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="l11mSy+8" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-7acd9a03ba9so2008238b3a.1 for ; Thu, 08 Jan 2026 02:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1767867384; x=1768472184; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=10vzVgMW/SIAVZiREFQWpaxB2zwT+8w8TEXAc8bNZjs=; b=l11mSy+8FndsHMTJYiiwv0cFca+qGjx5Wv55/cQ6brh+s4Z9Vf14PURhVRZMtQY90U Wl5vXcoyPAN+QN1hgXYrF2fwVQuEGK5f0ggqcEXEsHjhxrvye3VSblwE1TWFoZzJC6Ho 3mGLoEPNE9tBjBXOod7v6lUKSmp10bX4Y6627VnG9kaUmKrYcmKAuSkevgZLaYf9po/w kOJDmDP1ZiWgqDkNC52UV0VOz6U5zz7tYUL0bOAhOoiSxZM4Cbq37OZmMRqDcOukzmOy bct6DIy7DFcKZnEeN/c2gWBgnmrVjNn+2EUzLt7m5Cuet/xAeKcfN8zUPQ4j1G4XXqHg XIBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767867384; x=1768472184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=10vzVgMW/SIAVZiREFQWpaxB2zwT+8w8TEXAc8bNZjs=; b=UkeeUJJIw43m0qoLuvv8wOW8gOYt0XjqHN2LKLIdCigzYGddGcRryzMzZ1LT+FcVpP sd1M7Nnj7NEEZy3c+n0fh7ypjW4YLIfigzv1rhKatXKIa0b2lPcYcc7IjkYleCLPPpK9 ehFcixtp5bvqu8gRe8arufatA4IQNQ7UnhUX7x9I21h2415r6xJfqrymTdbDV9KaDzff d+EjjciMXh0IjnUqzGXR38Iz4JKOplp9LPjHlER/AHDZRs6rvqaIQN6RJR9DzDkE62Rt T95s4EU0qCzB6taRrLNztclSFhubaM4V5vEoDYpRjFkBrDyYDZdjSg22A2e1dsu2k2p1 eTwQ== X-Forwarded-Encrypted: i=1; AJvYcCX1psuZmKx+U1R9KSHA4EO3PMwVuXLfEqa78zdDKG9echUu5YNOBCZzBEssKOJLj4nFmUL94TVhg0+UPWA=@vger.kernel.org X-Gm-Message-State: AOJu0YzR2bSOvUa00gWswHZ1uZBcMpV7UUYsJjTIARZAhfRP3lBnKTOw JyGbrUKnk57cGD/8Lthd96CXOxB4mDci58FtP9Rebt929PP8gcbcge5m X-Gm-Gg: AY/fxX7LXTqMZs+EDNm3k+V2fAG9UdAJ5Fcj9YqHOLVVG300wlK/o6a4ONhR+Rcorlf ebHWtuIGaJx5l45nzL1azig+uzHpkk75HaIum8/eVpaxDMJCabFYe8vb2Zy4pO9MW4Z/XMchSbk cbQyLct9UjET7QFbXsNtrO/5ps18F/O6sJeWloHEMv0WTblan46ojTNANbexG5HiS2H7GlBDNOu n9O7D7dGZ4Tftj458DxkprEGuRJ1c6O+Kz6Hyo9JmUtJNUKHaC4nUSJ8lZpTp9fkjd8oht4KHqb m8DjlqiTlYvE0xcxqpbXz7fl7tTct3rj3RHyn7uOvNlAa35o/yjzT0xjwptqEKjQjOlsqUG7auT qS8z8u5M877Nxh5pvyjaBTvrkeNCxfvUbmw+kRXzIZrtvxSK2VrbaDM0eYsVPJgC+V96neY8/vH sTzftGJeY39qia686W7qxCK7AJ X-Google-Smtp-Source: AGHT+IEZ/zQHkmzZD5tH7EULcvT2Rbbyog8IW+xRrH5RFccnrCaoGMPZL2CJNEUsgMOip+rJXNFPnQ== X-Received: by 2002:a05:6a21:33a7:b0:366:1953:1d30 with SMTP id adf61e73a8af0-3898f8f54d1mr5334164637.5.1767867383759; Thu, 08 Jan 2026 02:16:23 -0800 (PST) Received: from localhost.localdomain ([240f:34:212d:1:8352:dfa:3b18:eb4e]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3c49299sm73785245ad.42.2026.01.08.02.16.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 02:16:23 -0800 (PST) From: Akinobu Mita To: akinobu.mita@gmail.com Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, david@kernel.org, mhocko@kernel.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, bingjiao@google.com Subject: [PATCH v3 1/3] mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes Date: Thu, 8 Jan 2026 19:15:33 +0900 Message-ID: <20260108101535.50696-2-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260108101535.50696-1-akinobu.mita@gmail.com> References: <20260108101535.50696-1-akinobu.mita@gmail.com> 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 Content-Type: text/plain; charset="utf-8" This makes it possible to create memory tiers using fake numa nodes generated by numa emulation. The "numa_emulation.adistance=3D" kernel cmdline option allows you to set the abstract distance for each NUMA node. For example, you can create two fake nodes, each in a different memory tier by booting with "numa=3Dfake=3D2 numa_emulation.adistance=3D576,704". Here, the abstract distances of node0 and node1 are set to 576 and 706, respectively. Each memory tier covers an abstract distance chunk size of 128. Thus, nodes with abstract distances between 512 and 639 are classified into the same memory tier, and nodes with abstract distances between 640 and 767 are classified into the next slower memory tier. The abstract distance of fake nodes not specified in the parameter will be the default DRAM abstract distance of 576. Signed-off-by: Akinobu Mita Reviewed-by: Jonathan Cameron --- v2: - fix the explanation about cmdline parameter in the commit log mm/numa_emulation.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/mm/numa_emulation.c b/mm/numa_emulation.c index 703c8fa05048..a4266da21344 100644 --- a/mm/numa_emulation.c +++ b/mm/numa_emulation.c @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include #include #include #include @@ -344,6 +347,27 @@ static int __init setup_emu2phys_nid(int *dfl_phys_nid) return max_emu_nid; } =20 +static int adistance[MAX_NUMNODES]; +module_param_array(adistance, int, NULL, 0400); +MODULE_PARM_DESC(adistance, "Abstract distance values for each NUMA node"); + +static int emu_calculate_adistance(struct notifier_block *self, + unsigned long nid, void *data) +{ + if (adistance[nid]) { + int *adist =3D data; + + *adist =3D adistance[nid]; + return NOTIFY_STOP; + } + return NOTIFY_OK; +} + +static struct notifier_block emu_adist_nb =3D { + .notifier_call =3D emu_calculate_adistance, + .priority =3D INT_MIN, +}; + /** * numa_emulation - Emulate NUMA nodes * @numa_meminfo: NUMA configuration to massage @@ -532,6 +556,8 @@ void __init numa_emulation(struct numa_meminfo *numa_me= minfo, int numa_dist_cnt) } } =20 + register_mt_adistance_algorithm(&emu_adist_nb); + /* free the copied physical distance table */ memblock_free(phys_dist, phys_size); return; --=20 2.43.0