Re: [PATCH RESEND v2 0/2] powercap: idle_inject: Create threads on demand
From: Rafael J. Wysocki (Intel)
Date: Fri Nov 20 2026 - 14:18:34 EST
On Wed, Nov 18, 2026 at 5:16 PM Daniel Lezcano
<daniel.lezcano@xxxxxxxxxxxxxxxx> wrote:
>
> Idle injection currently registers per-CPU kernel threads during early
> initialization, including on CPUs for which no idle injection device
> will be registered.
>
> This series makes thread creation follow the lifetime and CPU mask of
> each idle injection device.
>
> The first patch adds an optional CPU mask to smpboot thread descriptors.
> The mask restricts thread creation, CPU hotplug handling and teardown,
> while preserving the existing behavior for descriptors without a mask.
> Registrations sharing task storage are checked for overlapping CPU
> masks under smpboot_threads_lock before any threads are created.
>
> The second patch uses this support to register idle injection threads
> when a device registers and destroy them when it unregisters. CPU
> ownership claims, registration rollback and thread teardown are
> serialized to prevent overlapping registrations from sharing threads.
>
> The series was tested on Rockchip RK3588. The updated smpboot code and
> idle injection code also build with W=1. Concurrent registration and
> CPU hotplug runtime testing remains outstanding.
>
> Changes in v2:
> - Reject overlapping smpboot registrations sharing per-CPU task storage
> with WARN_ON_ONCE() and -EBUSY, as suggested by Thomas Gleixner.
> - Default a NULL CPU mask to cpu_possible_mask at registration and
> remove redundant NULL-mask checks from the lifecycle helpers.
> - Use scoped guards for the smpboot registration locks.
> - Document the overlap restriction and registration return values, and
> update the core commit explanation.
> - Add Bradley Morgan's Reviewed-by tag to the idle injection patch.
>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Rafael J. Wysocki <rafael@xxxxxxxxxx>
> Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: Bradley Morgan <brads@xxxxxxxxxxxxxx>
>
> Daniel Lezcano (2):
> smpboot: Allow restricting per-CPU threads to a CPU mask
> powercap: idle_inject: Create per-CPU threads on registration
>
> drivers/powercap/idle_inject.c | 69 +++++++++++++++++++++-------------
> include/linux/smpboot.h | 6 +++
> kernel/smpboot.c | 45 +++++++++++++++++-----
> 3 files changed, 83 insertions(+), 37 deletions(-)
>
Applied as 7.5 material, thanks!