void put_online_cpus(void) { if (cpu_hotplug.active_writer == current) return; if (!mutex_trylock(&cpu_hotplug.lock)) { atomic_inc(&cpu_hotplug.puts_pending); cpuhp_lock_release(); return; } if (WARN_ON(!cpu_hotplug.refcount)) cpu_hotplug.refcount++; /* try to fix things up */ if (!--cpu_hotplug.refcount && unlikely(cpu_hotplug.active_writer)) wake_up_process(cpu_hotplug.active_writer); mutex_unlock(&cpu_hotplug.lock); cpuhp_lock_release(); }
void put_online_cpus(void) { int refcount; if (cpu_hotplug.active_writer == current) return; refcount = atomic_dec_return(&cpu_hotplug.refcount); if (WARN_ON(refcount < 0)) /* try to fix things up */ atomic_inc(&cpu_hotplug.refcount); if (refcount <= 0 && waitqueue_active(&cpu_hotplug.wq)) wake_up(&cpu_hotplug.wq); cpuhp_lock_release(); }
void cpu_hotplug_done(void) { cpu_hotplug.active_writer = NULL; mutex_unlock(&cpu_hotplug.lock); cpuhp_lock_release(); }