Messages in this thread | | | Date | Thu, 11 Dec 2014 10:56:47 +0100 | From | David Hildenbrand <> | Subject | Re: [PATCH v4] CPU hotplug: active_writer not woken up in some cases - deadlock |
| |
> This is subjective, but how about > > static bool xxx(void) > { > mutex_lock(&cpu_hotplug.lock); > if (atomic_read(&cpu_hotplug.refcount) == 0) > return true; > mutex_unlock(&cpu_hotplug.lock); > return false; > } > > void cpu_hotplug_begin(void) > { > cpu_hotplug.active_writer = current; > > cpuhp_lock_acquire(); > wait_event(&cpu_hotplug.wq, xxx()); > } > > instead? > > Oleg. >
Just checked wait_event(). It is safe against such race conditions as the same pattern is used is applied internally.
Thanks!
David
| |