Skip to content

Commit 0eff049

Browse files
committed
Merge tag 'smp-core-2024-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull CPU hotplug updates from Thomas Gleixner: "A small set of SMP/CPU hotplug updates: - Reverse the order of iteration when freezing secondary CPUs for hibernation. This avoids that drivers like the Intel uncore performance counter have to transfer the assignement of handling the per package uncore events for every CPU in a package, which is a considerable speedup on larger systems. - Add a missing destroy_work_on_stack() invocation in smp_call_on_cpu() to prevent debug objects to emit a false positive warning when the stack is freed. - Small cleanups in comments and a str_plural() conversion" * tag 'smp-core-2024-07-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: smp: Add missing destroy_work_on_stack() call in smp_call_on_cpu() cpu/hotplug: Reverse order of iteration in freeze_secondary_cpus() smp: Use str_plural() to fix Coccinelle warnings cpu/hotplug: Fix typo in comment
2 parents 0e4b77d + 77aeb1b commit 0eff049

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

include/linux/cpuhotplug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* startup callbacks sequentially from CPUHP_OFFLINE + 1 to CPUHP_ONLINE
2828
* during a CPU online operation. During a CPU offline operation the
2929
* installed teardown callbacks are invoked in the reverse order from
30-
* CPU_ONLINE - 1 down to CPUHP_OFFLINE.
30+
* CPUHP_ONLINE - 1 down to CPUHP_OFFLINE.
3131
*
3232
* The state space has three sections: PREPARE, STARTING and ONLINE.
3333
*

kernel/cpu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,8 +1894,8 @@ int freeze_secondary_cpus(int primary)
18941894
cpumask_clear(frozen_cpus);
18951895

18961896
pr_info("Disabling non-boot CPUs ...\n");
1897-
for_each_online_cpu(cpu) {
1898-
if (cpu == primary)
1897+
for (cpu = nr_cpu_ids - 1; cpu >= 0; cpu--) {
1898+
if (!cpu_online(cpu) || cpu == primary)
18991899
continue;
19001900

19011901
if (pm_wakeup_pending()) {

kernel/smp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/nmi.h>
2626
#include <linux/sched/debug.h>
2727
#include <linux/jump_label.h>
28+
#include <linux/string_choices.h>
2829

2930
#include <trace/events/ipi.h>
3031
#define CREATE_TRACE_POINTS
@@ -982,8 +983,7 @@ void __init smp_init(void)
982983
num_nodes = num_online_nodes();
983984
num_cpus = num_online_cpus();
984985
pr_info("Brought up %d node%s, %d CPU%s\n",
985-
num_nodes, (num_nodes > 1 ? "s" : ""),
986-
num_cpus, (num_cpus > 1 ? "s" : ""));
986+
num_nodes, str_plural(num_nodes), num_cpus, str_plural(num_cpus));
987987

988988
/* Any cleanup work */
989989
smp_cpus_done(setup_max_cpus);
@@ -1119,6 +1119,7 @@ int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
11191119

11201120
queue_work_on(cpu, system_wq, &sscs.work);
11211121
wait_for_completion(&sscs.done);
1122+
destroy_work_on_stack(&sscs.work);
11221123

11231124
return sscs.ret;
11241125
}

0 commit comments

Comments
 (0)