summaryrefslogtreecommitdiff
path: root/include/linux/cpu.h
diff options
context:
space:
mode:
authorWaiman Long <longman@redhat.com>2018-07-24 14:26:04 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-07-26 10:37:36 +0200
commit6f4ceee9305dc3fe74099159b460f4b56b506f1d (patch)
tree167a0733c55bae01d2ccb6ac7c0148144d0b3589 /include/linux/cpu.h
parent601b218568a107370086dc5c7a1b283f8d463268 (diff)
downloadlwn-6f4ceee9305dc3fe74099159b460f4b56b506f1d.tar.gz
lwn-6f4ceee9305dc3fe74099159b460f4b56b506f1d.zip
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 'include/linux/cpu.h')
-rw-r--r--include/linux/cpu.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index a97a63eef59f..e850bfea3e84 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -103,6 +103,7 @@ extern void cpus_write_lock(void);
extern void cpus_write_unlock(void);
extern void cpus_read_lock(void);
extern void cpus_read_unlock(void);
+extern int cpus_read_trylock(void);
extern void lockdep_assert_cpus_held(void);
extern void cpu_hotplug_disable(void);
extern void cpu_hotplug_enable(void);
@@ -115,6 +116,7 @@ static inline void cpus_write_lock(void) { }
static inline void cpus_write_unlock(void) { }
static inline void cpus_read_lock(void) { }
static inline void cpus_read_unlock(void) { }
+static inline int cpus_read_trylock(void) { return true; }
static inline void lockdep_assert_cpus_held(void) { }
static inline void cpu_hotplug_disable(void) { }
static inline void cpu_hotplug_enable(void) { }