diff options
author | Waiman Long <longman@redhat.com> | 2018-07-24 14:26:04 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-07-26 10:37:36 +0200 |
commit | 6f4ceee9305dc3fe74099159b460f4b56b506f1d (patch) | |
tree | 167a0733c55bae01d2ccb6ac7c0148144d0b3589 /kernel/cpu.c | |
parent | 601b218568a107370086dc5c7a1b283f8d463268 (diff) | |
download | op-kernel-dev-6f4ceee9305dc3fe74099159b460f4b56b506f1d.zip op-kernel-dev-6f4ceee9305dc3fe74099159b460f4b56b506f1d.tar.gz |
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>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 0db8938..307486b 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -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); |