freenode
Kernel & Low-Level

Kernel series peels stop_machine off CPU teardown for RT and nohz_full

Frederic Weisbecker’s 47-patch rework lets most hot-unplug steps run without freezing every CPU, clearing a path for isolated and real-time partitions.

Frederic Weisbecker has posted a second-round, 47-patch series that strips the global stop_machine barrier out of almost all of CPU hot-unplug, leaving only the final teardown step under the full-system freeze. The change targets a long-standing clash between CPU offlining and workloads that cannot tolerate every core spinning with interrupts off: real-time tasks and nohz_full isolated partitions.

Today, taking a CPU down runs a long stretch of dying and teardown callbacks while stop_machine holds every other processor. That freezes the machine even when the work being done on the outgoing CPU could safely proceed in parallel. The friction shows up when operators try to create isolated cpusets or nohz_full partitions while latency-critical work is already running, a scenario raised at the Linux Plumbers Conference.

Weisbecker’s approach adds a post callback to stop_machine. The main function still runs with all other CPUs spinning; once that returns, those CPUs may leave the stop while the target keeps interrupts disabled and runs the post function. Every hotplug state between online and offline that can tolerate concurrent activity on the rest of the system is moved into that post path, each with its own justification. Architecture timer teardown, tick dying (with a wake-up of the new timekeeper for dynticks CPUs), RCU, scheduler, cache control, and similar steps are among those relocated.

When the series lands, only the core CPU disable step remains inside the global stop. Weisbecker sketches a follow-on that would clear the CPU from the online mask, wait out an RCU grace period with interrupts still off, and then finish architecture-specific disable without parking the whole machine. For RT and isolated-CPU users, the immediate payoff is hot-unplug that no longer stops the world for work that does not need it.