From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 BB8A227FD49 for ; Sun, 5 Jul 2026 17:16:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783271818; cv=none; b=EMOgU/BZTmTpStqFmtKhMhPtMpp0G7EiQXvDWEsE6QiXSQyNc95IhPzzPw3EaYalXqgbYOIUCXsTiqtqVb5AXxdyZe2vMa2wuX8C9vqV1iNby+fR3PVrRwcCzj8lHYa2b/oNqYG+wZdXYy9sLDohlBW91jyIwsJf2Mdm4ZTVmdc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783271818; c=relaxed/simple; bh=RfeEimx28ieEdq7P0cKN1YdsaTExj3BS4lxsF7eMLYQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XzudUYtHX6DKXlPNOm8DFtPnQPCEmIcPdOjsbcRJQQljff2yCkkOigqCr8j92RmLDkvPFJjULZFdbLIJpx1KknFN6NTzQQq0PkRs7pWDBdlR657nKHPXJg5BOwlI2fDLHN2xveO0diz2E7bOradohmIXzrZUAtGpw/ZscS+IOPw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SzqgA363; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SzqgA363" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783271813; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=nJ+0qfg2D0fF1BhqSzuojfU6g+Kj48QxEfXSUblg3Ao=; b=SzqgA363rGlSA1aqMTv3ZGUGToh9ppSiLfvYpca8j6QkOiV7llhxT1+DYQ8lFkAD8O1itn PqeynPImsaavaeE5qkaMiLj7GQc0mWW/Vc/J1lL9j9PJt0+tsVQi8E4esdzmWmqa9e3xVo npK6ff5qh9trtbwNPgixyJTL3fNDQwk= From: Thorsten Blum To: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" Cc: Thorsten Blum , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] x86/mm/numa: Clean up topology parsing in amd_numa_init() Date: Sun, 5 Jul 2026 19:16:31 +0200 Message-ID: <20260705171631.338768-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1863; i=thorsten.blum@linux.dev; h=from:subject; bh=RfeEimx28ieEdq7P0cKN1YdsaTExj3BS4lxsF7eMLYQ=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFleE/N3VTQuOmrkWcdy9NHSyuORd80+aznu+bXkYvGr/ Tdk7h7c3FHKwiDGxSArpsjyYNaPGb6lNZWbTCJ2wsxhZQIZwsDFKQATufuR4X+cDeeWTf8kRJa8 Vl3rreOmsEDsf0vwfQ9jtlOXU3k/S/5l+MPhae/jVugY1e2kbtLvua1QU3Ytb1I0434L1gXxW+6 HMQIA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Since commit e23bba604433 ("x86-64, NUMA: Unify emulated distance mapping"), nodeids[] is only written but never read. Remove it. Also drop the start variable and the base < start clamp, since start is always zero and the expression always false. While at it, use min() for the limit > end clamp and drop the redundant second limit > end clamp. Signed-off-by: Thorsten Blum --- arch/x86/mm/amdtopology.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/arch/x86/mm/amdtopology.c b/arch/x86/mm/amdtopology.c index f980b0eb0105..d68d345a5b82 100644 --- a/arch/x86/mm/amdtopology.c +++ b/arch/x86/mm/amdtopology.c @@ -27,8 +27,6 @@ #include #include -static unsigned char __initdata nodeids[8]; - static __init int find_northbridge(void) { int num; @@ -56,7 +54,7 @@ static __init int find_northbridge(void) int __init amd_numa_init(void) { unsigned int numnodes, cores, apicid; - u64 prevbase, start = PFN_PHYS(0); + u64 prevbase; u64 end = PFN_PHYS(max_pfn); u32 nodeid, reg; int i, j, nb; @@ -84,7 +82,7 @@ int __init amd_numa_init(void) base = read_pci_config(0, nb, 1, 0x40 + i*8); limit = read_pci_config(0, nb, 1, 0x44 + i*8); - nodeids[i] = nodeid = limit & 7; + nodeid = limit & 7; if ((base & 3) == 0) { if (i < numnodes) pr_info("Skipping disabled node %d\n", i); @@ -115,19 +113,12 @@ int __init amd_numa_init(void) limit >>= 16; limit++; limit <<= 24; - - if (limit > end) - limit = end; + limit = min(limit, end); if (limit <= base) continue; base >>= 16; base <<= 24; - - if (base < start) - base = start; - if (limit > end) - limit = end; if (limit == base) { pr_err("Empty node %d\n", nodeid); continue;