cpu/hotplug: Add a cpus_read_trylock() function
There are use cases where it can be useful to have a cpus_read_trylock() function to work around circular lock dependency problem involving the cpu_hotplug_lock. Signed-off-by: Waiman Long <longman@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:

committed by
Rafael J. Wysocki

parent
601b218568
commit
6f4ceee930
@@ -290,6 +290,12 @@ void cpus_read_lock(void)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpus_read_lock);
|
||||
|
||||
int cpus_read_trylock(void)
|
||||
{
|
||||
return percpu_down_read_trylock(&cpu_hotplug_lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpus_read_trylock);
|
||||
|
||||
void cpus_read_unlock(void)
|
||||
{
|
||||
percpu_up_read(&cpu_hotplug_lock);
|
||||
|
Reference in New Issue
Block a user