From nobody Sun Feb 8 18:15:17 2026 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 116D221D3E4 for ; Mon, 22 Dec 2025 00:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766364562; cv=none; b=VURo1nRUN167ZqktXv4QT648+BsKIK6VZNfu/qCqG1QG81uHq6AzIgTKfuCWM7cM5mqmeq3dA4bqxtnppbpFqWp9tyjP+4SfKkHR3XzagRIXtFUrvQpGbEfy1QQeTegdR4tVFqRY0ZsKQQ5Ap4WeUZf5M55IFTibIZjprSQHweU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766364562; c=relaxed/simple; bh=uwpd6A8/JJiZRPsY0eYWPt+toE8mJr3sa3KvHSB6r6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KjHZx5t/XO6tgykmWDDOKOkC6gqKyL9Lglt3A0wB+CrjczZNgTF77LuDSK6mgcCxe8XAFqrYjPi7s2EMA8BSxocFlHOOlE3IU/opSJlpNLxrl5BAVqug6YE/IiGuzXnVCV9BunNsC+2UnbhDQCRxoJ0c8YcjHB4HQA5BCKe74ck= 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=G+9wf30e; arc=none smtp.client-ip=209.85.214.173 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="G+9wf30e" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2a102494058so22172065ad.0 for ; Sun, 21 Dec 2025 16:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766364560; x=1766969360; 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=G+9wf30e62Idhr6Dn/aKSNfTzIWCDzQro2Jf9UhazyYGS3tTXR9EvrhauwstQik2WC Xgh1HM7UocOfslvN2ehoa/lSrYbt8se94R4pfJKKpchde8P2RULiddxFMOr95CQ5Pc9Z uajyii3PabRXlryf28vGVRkxY7BO1bJ8Aa96MBNGVH5MiOF6px9WOG3g1Cd0wv0ht/lZ YmrysSv//47lcX4IoYjzIZ9kCPWZnFBirSbvCG+ksGxvWYRzCRlHrZuzijhe2vNfGi3W WZ3HB8Y7bfuZcAkpKflMiQiXPclZXIwNzADyES7uzNj7dvVb9mCC4gNWCBxKbVAu1pRw rYuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766364560; x=1766969360; 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=hhYorIIBwjdq8x5XjbVjUzkbNcPCNdz1AThcluIOZN4w7ExFAtm1PNZxQreugrO0MB yyNQ6QzjEWYm35GM7h3qjfafTxQa5TiONOOVgEe887X5PtTup37dyT5ntKoQskyZqTgK RGB8eEBZAIJYHt2K7riPTJYc+GmqlGUAvmbYCvAP50aSOY5gPSz/3dSuKyGdtCO2Pvdg g30pdwIfRazuEiZJqx7O6sVkfWkKI7bR06J4THV6XhzY0ZqzKcXVMip4A/3U+PgTJzFi ko5asXqLr7rMEsgyjA64vE1DXHjFOqS7th6yKVdnG+3y/NIRjNZ29IPaPudscMfco7ly 7mug== X-Forwarded-Encrypted: i=1; AJvYcCVutNuRQb/uMhW1RtdYQtobFzf7+437SQB9DGxe7PnlG2v15XWad3GSs+Kt1+GcSjp3ByDxa61kFvwatmQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzSWVBInDrUC67rEU3sSgTaiC5Oxi1bnxxs5fMU+qETIY/pU6OD dW+t1sFZkddFrfsLcjy4ksGIdQ+Dl2aTRlrQrnYRJE0dwMQGM4kOTg8o X-Gm-Gg: AY/fxX48OWIlLCf2d07V7/uvLWU0tC+AM6b+PotN5m42GgI6g8WNhSnyYQ1CQaDmxIQ 2n5ROCL8jG2zZ/lhiAwXh/mrZXwZjmrHEqlLrVLzSCEGONP0G71/VObrOOEYex94LLGpSBisXvu 3LO8RmzLzv/oOebehojTxNjdQWmYDnGQ8H3iNXZx2Eb2DZq1qbZdt3hpwU0w3OS7s6oSeiRAXTf S/gaUfPjRGPEI3syhifjoxEk9bNWmQhNo89YO1mPh3T1u2wvvJsMJpCfIi0nroOEd6PvVv2rfPm NEch/ZI+L/Vok5b6q+4IyOBns4ldcHqCaSqyJXk3arVlVv9MnaOeo2jnpaGkercDAGSvX3zRIRX OV0/39En2YgMpOeg6KuEpQx2Qr2MO06tFSdDnuPb/I0cNUElYEBjFzow5Z2eeUeSPYwRJTIJoX1 /jrDTA/A3bilNZ4JEwsii3LX3qbg== X-Google-Smtp-Source: AGHT+IGJcxUPthsfQvfgIvDDUW9++z5bU5TtJMiOACtXv5gVSZp4E6tKXbai45W4KorvPXSKizQXDQ== X-Received: by 2002:a17:90b:3c4d:b0:340:6b6f:4bbf with SMTP id 98e67ed59e1d1-34e71e6a525mr11996986a91.18.1766364560272; Sun, 21 Dec 2025 16:49:20 -0800 (PST) Received: from localhost.localdomain ([240f:34:212d:1:df7d:b611:ffaf:6d45]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c1e79620bd3sm7461832a12.4.2025.12.21.16.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Dec 2025 16:49:19 -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 Subject: [PATCH v2 1/3] mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes Date: Mon, 22 Dec 2025 09:48:32 +0900 Message-ID: <20251222004834.10539-2-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251222004834.10539-1-akinobu.mita@gmail.com> References: <20251222004834.10539-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 --- 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