From nobody Sun Feb 8 21:09:35 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 C3A38168DC; Wed, 10 Apr 2024 05:23:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712726594; cv=none; b=RM7hSsSQ2wXQJczGlkhQTyYC025YKC2HfIvFmdqdUfiC90RrzVpuPbn8+bJr/MEAbNOFoWp6HUsFrQz9RnlbCML+a26mZuXpU6dL0e1FU5kGmCZ4LrKVCpChpwZfGIlJ65eBKzPmSJ9W+69bnr1ScdHfqDGnYWiT8A9Jim+kW44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712726594; c=relaxed/simple; bh=7WSNNJs7UyJbths+Isy28tlrWPS4bjdTksBrpY3Fyo8=; h=Date:From:To:Subject:Cc:MIME-Version:Message-ID:Content-Type; b=sW0xLRzYSbW4reeRoApcMP69zgqaELR5h+Fe0o3WKWkcm6I2+i7lnwwFF+ydd9I/gi3CzXQN731IyQDgV8KN255vxx6GhgOdIs9WL/BGgGG6CrC3tj7UkWoaS3yeMLJkyVEPRamK+Jjex4JfnvQZ9R8piJfDa/oHKtoQeBMlJ8k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=nPSoOKlS; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=X6b2q5ha; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="nPSoOKlS"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="X6b2q5ha" Date: Wed, 10 Apr 2024 05:23:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712726590; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j3DJxnKQpZ6uYxT75l5TYFJqwFWV3Gg/e+kg/xTKbKM=; b=nPSoOKlSvD2HJi6A41/D7nVxbm5Fo2zBM2DuKn+rb9deH1J2YCGbdrBfKlxvB5Y8FNiPiK zjYrRgLGgAhqrPzw8BtXYnFCXkJmc+dCq10k5ZNBfYT+qpYXPk91+ivo2EabIjXVEHESd5 n7W6IRAbBhhGXJAOs1hdzQhwDVAi/dyvNRo+exkLpSyW+L6/6j9iQwXxICt7HKpDoH6JTQ czDjH/dzRY0tkfI6HlPikWHPVT5B7q1gReE7pos27bIza+Jdvl1HLSJuE/7gUnH/dmsXeO g+CPbIu+a5kYYCB9B2tvst2RtnM7MHZcwsy/Lu11xiJx4yCHkg8glV8GZR2gHw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712726590; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j3DJxnKQpZ6uYxT75l5TYFJqwFWV3Gg/e+kg/xTKbKM=; b=X6b2q5hawNMlneFiT+aZfqnr+BNL5IccP7zH0wctetgQpw1IFEjMfrpPcaLmnrQnJf3SiG c8nEqOWjc4h1xrDQ== From: "tip-bot2 for Ingo Molnar" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/cpu: Improve readability of per-CPU cpumask initialization code Cc: Ingo Molnar , linux-kernel@vger.kernel.org, x86@kernel.org Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171272658996.10875.10321970678195678587.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/cpu branch of tip: Commit-ID: dbbe13a6f66b228a2867844ad4dd108576134775 Gitweb: https://git.kernel.org/tip/dbbe13a6f66b228a2867844ad4dd10857= 6134775 Author: Ingo Molnar AuthorDate: Wed, 10 Apr 2024 06:59:47 +02:00 Committer: Ingo Molnar CommitterDate: Wed, 10 Apr 2024 07:02:33 +02:00 x86/cpu: Improve readability of per-CPU cpumask initialization code In smp_prepare_cpus_common() and x2apic_prepare_cpu(): - use 'cpu' instead of 'i' - use 'node' instead of 'n' - use vertical alignment to improve readability - better structure basic blocks - reduce col80 checkpatch damage Signed-off-by: Ingo Molnar Cc: linux-kernel@vger.kernel.org --- arch/x86/kernel/apic/x2apic_cluster.c | 8 +++++--- arch/x86/kernel/smpboot.c | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/apic/x2apic_cluster.c b/arch/x86/kernel/apic/x= 2apic_cluster.c index afbb885..7db8321 100644 --- a/arch/x86/kernel/apic/x2apic_cluster.c +++ b/arch/x86/kernel/apic/x2apic_cluster.c @@ -178,14 +178,16 @@ static int x2apic_prepare_cpu(unsigned int cpu) u32 phys_apicid =3D apic->cpu_present_to_apicid(cpu); u32 cluster =3D apic_cluster(phys_apicid); u32 logical_apicid =3D (cluster << 16) | (1 << (phys_apicid & 0xf)); + int node =3D cpu_to_node(cpu); =20 x86_cpu_to_logical_apicid[cpu] =3D logical_apicid; =20 - if (alloc_clustermask(cpu, cluster, cpu_to_node(cpu)) < 0) + if (alloc_clustermask(cpu, cluster, node) < 0) return -ENOMEM; - if (!zalloc_cpumask_var_node(&per_cpu(ipi_mask, cpu), GFP_KERNEL, - cpu_to_node(cpu))) + + if (!zalloc_cpumask_var_node(&per_cpu(ipi_mask, cpu), GFP_KERNEL, node)) return -ENOMEM; + return 0; } =20 diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 536dad1..a581095 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1033,21 +1033,22 @@ static __init void disable_smp(void) =20 void __init smp_prepare_cpus_common(void) { - unsigned int i, n; + unsigned int cpu, node; =20 /* Mark all except the boot CPU as hotpluggable */ - for_each_possible_cpu(i) { - if (i) - per_cpu(cpu_info.cpu_index, i) =3D nr_cpu_ids; + for_each_possible_cpu(cpu) { + if (cpu) + per_cpu(cpu_info.cpu_index, cpu) =3D nr_cpu_ids; } =20 - for_each_possible_cpu(i) { - n =3D cpu_to_node(i); - zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map, i), GFP_KERNEL, n); - zalloc_cpumask_var_node(&per_cpu(cpu_core_map, i), GFP_KERNEL, n); - zalloc_cpumask_var_node(&per_cpu(cpu_die_map, i), GFP_KERNEL, n); - zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, i), GFP_KERNEL, n); - zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, i), GFP_KERNEL, n); + for_each_possible_cpu(cpu) { + node =3D cpu_to_node(cpu); + + zalloc_cpumask_var_node(&per_cpu(cpu_sibling_map, cpu), GFP_KERNEL, n= ode); + zalloc_cpumask_var_node(&per_cpu(cpu_core_map, cpu), GFP_KERNEL, n= ode); + zalloc_cpumask_var_node(&per_cpu(cpu_die_map, cpu), GFP_KERNEL, n= ode); + zalloc_cpumask_var_node(&per_cpu(cpu_llc_shared_map, cpu), GFP_KERNEL, n= ode); + zalloc_cpumask_var_node(&per_cpu(cpu_l2c_shared_map, cpu), GFP_KERNEL, n= ode); } =20 set_cpu_sibling_map(0);