From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 92816500954 for ; Fri, 9 Jan 2026 04:44:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767933860; cv=none; b=uxiEBAxD6FYqoIVOGtnFHOrqitSmB5LkMCQ1S2CpQ0j8F+pbon2SPx2OPMETICUF13PjS3rI7ycVFt1AGKhRoWUh0l8sZbs8CuEaUZSVPJ8/gofp3wJOHtElTdLfuXZyFGslAvjuS39xKQKG9FLkAV+g1R2bHL41wEWD/ZcNB0I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767933860; c=relaxed/simple; bh=D0UGfay3dsna+FGkp+Qbtn2m4AUWrP4lzsCEMgm1HfA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oR2ZAt34hTZvEX6dZChbOwJkN6Q1jRkfX8VmQwJkwu0gPmUdB7tWhFmYlwk7FbmOudvBzgD0egBwWzf9ncgGanIAQUbSLHjRdudY1g6CZodRAdrzScb8Ap4mxHlTco8z4B3zNgBYaOc6wwVF8tvAcEWcGKidIM9Ee8WFAJIl9qw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=h3D7YraT; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=kqkVsx1t; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="h3D7YraT"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="kqkVsx1t" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 608Iqxdt3141619 for ; Fri, 9 Jan 2026 04:44:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 9PMU9ieb1QmCoXo11coZcBcipTvyHbkjE2lSzxbfThY=; b=h3D7YraTfVmsM947 ssAm268Ecx0hciT9Z4P/p3YNMwdJ9No2awOjCMsug+ChBVc941iiP7TldxzGPBqa V/JTyEzFcTqAt/HJYh9eGijEQQDJL+pnYzzb/W28YmE68ZBNqijzHFtOTf3rJjvT yY4rryx0RtHnbufPqf1fuu5ZQQCQX7BSwlLdaoUNqfQrH6joIplWawpsULAeOloN FgIdSEn+3IavIxmfYxdal/UJBXhquwNJP6lfsJb1TZZfuOPohHeVVLRaawdjqMfb wB+15Ywi6Usvs4R2Yv6pntwve3M+nZkybOdtMn6YTUAVJojbD+7ImQf8NLT/pOe3 zPBMYg== Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bjj8j1aky-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 09 Jan 2026 04:44:17 +0000 (GMT) Received: by mail-pl1-f197.google.com with SMTP id d9443c01a7336-2a0d59f0198so42606795ad.1 for ; Thu, 08 Jan 2026 20:44:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1767933856; x=1768538656; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=9PMU9ieb1QmCoXo11coZcBcipTvyHbkjE2lSzxbfThY=; b=kqkVsx1trpcyZpjo5TPryavkmSObWjksL2SATronXcw8c1EVkd5weNPFb0pX6MxL83 DzWm/cQKz9+DVqbkE+K+hKa/itsJ/w3HU4R3uU17u9/YeHl24yifwNQ7evcTej5IGuH6 sxS3AJEjGHkqJN0hiRhsP6SaTmjumW53q4s4bBjNmh3ZWBFGJcz7uA8cElbylkAK2BKh HOkTzKgT2deb0Y49jMx4kFVIIF77uhnMQu3zhm9QfrgV3rDM5TQHK29t4L31b8ynmcGN FgcqHBn+QVTu+2Av2hYnWJ/qtUiwR1/NuQs1Q6fGWyyF6S53SvraZ27JZTCBjh913RyF dQqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767933856; x=1768538656; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9PMU9ieb1QmCoXo11coZcBcipTvyHbkjE2lSzxbfThY=; b=JqnMjQ3hePL5pTHrOkEyi9M+39+8WVl/GdemBcd07Uo4AxHBHidfsCZ7dZt0/UuFN5 W0l5cnT8R/dKTLYYPE7zsTbu7f/qMJ0aJdGdLQiMgXnWB72ZC69sEqPG5JPgWllmZTSC mZyXtIONzhPgScjD5QYtkvONqkq38xcVZyBcIgC2zfXsDbDoGGCV3rTa7xtfwpM9jJnL 0NcaGvjIHYp4F6SX1mpKJiktubC5PwfNexsGq1YWlushxQnx+Fs2bZtrGIxy7XPTz8qh jUIul9hNRaoBCYTbYef90s1hBUS7g+ymlO+UVR14Lo8RLLRz1L8fAt1gMHhI56JywM9N 47eQ== X-Forwarded-Encrypted: i=1; AJvYcCUfPg9KzCDbhIxpGlP3z1asvUwC8zJAuyLE5WrwZvhQ3WCrZETDvu5hxJ7rTdIVrqyH9xK4vpaypXVJFFE=@vger.kernel.org X-Gm-Message-State: AOJu0YyrHKWbOXFBeqfALNgXUSHeDw0aqrHqn62J/CgQMNW054Flsowp x5ANInRqb8Xsytirqls1sC91eDJxXm4QnZSqORqJoqSBArpEG+PcExxWD9YL/9WxbF1EYlUa8Po 1vxx2Kn1UGx7Qt66rE41IkNN7Eo/brQ6u04IRfzoSBeEu6iLzVOBDtUYbItkZTRDmBmo= X-Gm-Gg: AY/fxX7gYkrN7cL2lL9lneoxHssaWt5BbTTDU6x5Ylvy0ncz8t9KTv4RwNOsuJ9IGSn WrMUYyql5mfpeZBjqXE//mrKSjKaGLV+om4aJcxnIj4cXSWMixT+sOLosHverkgvhBwQfFqexHL s+D8o1Sdlb1eDHZ6SBzL/DTOygSxm41ITzb+qDYk8Nvxr5TG1U7e3nd3S91TMoB3VwC4yH0pHMf DLYnbAP0lUymf0n4RMI13VG9oRsa9eWJAPtY7GdQyO4DVmfDx+ZNfnJMCE3O8RLmk1tFmQ5FiAK eOykZUqEEIXFzTyVARAptuR06njebn0vQeTWLVkiQzaEzvZDCM/HybXINn5LAqUzei4E6Elhj6p ysKRei8/1/lU8T3Xe/pH0KrB3X/aPROEzU1JoWEi8Gng= X-Received: by 2002:a17:903:a8f:b0:2a1:3e15:380e with SMTP id d9443c01a7336-2a3ee4aae30mr77088445ad.34.1767933856410; Thu, 08 Jan 2026 20:44:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFB3u+HKizZWgXaPWyivW/bF/qgEHwpzZILB1cDaAISw9tmf93lNmF0fhBODQ2Q/mtucKddLQ== X-Received: by 2002:a17:903:a8f:b0:2a1:3e15:380e with SMTP id d9443c01a7336-2a3ee4aae30mr77088205ad.34.1767933855925; Thu, 08 Jan 2026 20:44:15 -0800 (PST) Received: from [192.168.1.9] ([122.171.107.71]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3cd2b3asm91438525ad.88.2026.01.08.20.44.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Jan 2026 20:44:15 -0800 (PST) Message-ID: Date: Fri, 9 Jan 2026 10:13:11 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/3] mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes To: Akinobu Mita 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 References: <20260108101535.50696-1-akinobu.mita@gmail.com> <20260108101535.50696-2-akinobu.mita@gmail.com> Content-Language: en-US From: Pratyush Brahma In-Reply-To: <20260108101535.50696-2-akinobu.mita@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTA5MDAyOSBTYWx0ZWRfX6m+BKlA4hdV0 NtI0INMnCLRYETEjipU2P8RaqjZ8t5st9FGxYP1sTV2mNcrsudCBNza+7LaguHlu7x7EZzqJVTu Uc5rPcNGYgZ5Zu3M0REB8olXZS2kbjEulRdUnVy58kgZ/SRzamOiFDbV9+fh7PXhHExgJd5tB4Z 4KyvEZT5Kfi2ak/UfH9VAUpuEYh3u/wJq5f/DsMYTdpdkXXK+UY12o9rsAarjnKZXxvK31r/sgX petXzneTWLwtzNipx740jFxkkHQyRq3vOww0aqdLgaFrh0f1AndA+lP51i67xcxXnbtwWshlIC2 1e3wYKkh2to9Jdxt8Z0mvrzpz5op3fBPmJ99mZU/XnmsvkbqAQ/6XvIHo6C5pOo+O6TciYfaSa0 p5o1F7AtWB1EbQosouXxy3zH2YLvsPzu8rhJzdA7gULx+BiE8FxRlLseJ/tsmAI2RshLcoOJVCa FjT0IqS58rVaczo1NDQ== X-Authority-Analysis: v=2.4 cv=JIs2csKb c=1 sm=1 tr=0 ts=696087a1 cx=c_pps a=cmESyDAEBpBGqyK7t0alAg==:117 a=yzROskTkGupuC83a2laO1A==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=pGLkceISAAAA:8 a=gTkrCQ11ykXsVYlltkQA:9 a=QEXdDO2ut3YA:10 a=1OuFwYUASf3TG4hYMiVC:22 X-Proofpoint-GUID: oUkK0cDMQRtGAnpwLYWc3EMIdRLeacry X-Proofpoint-ORIG-GUID: oUkK0cDMQRtGAnpwLYWc3EMIdRLeacry X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-09_01,2026-01-08_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 clxscore=1011 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2512120000 definitions=main-2601090029 On 1/8/2026 3:45 PM, Akinobu Mita wrote: > This makes it possible to create memory tiers using fake numa nodes > generated by numa emulation. > > The "numa_emulation.adistance=" 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=fake=2 numa_emulation.adistance=576,704". > Here, the abstract distances of node0 and node1 are set to 576 and 706, You mention 704 in the cmdline but then mention 706 in the following text. Please correct the typo. Btw I am not entirely sure if this example is required in the commit text here. The Documentation seems to the right place for this. > 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; > } > > +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 = data; > + > + *adist = adistance[nid]; > + return NOTIFY_STOP; > + } > + return NOTIFY_OK; > +} > + > +static struct notifier_block emu_adist_nb = { > + .notifier_call = emu_calculate_adistance, > + .priority = 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_meminfo, int numa_dist_cnt) > } > } > > + register_mt_adistance_algorithm(&emu_adist_nb); > + > /* free the copied physical distance table */ > memblock_free(phys_dist, phys_size); > return; Best Regards Pratyush