summaryrefslogtreecommitdiff
path: root/include/linux/workqueue.h
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-05-13 12:32:28 -0700
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2010-06-14 16:37:26 -0700
commita25909a4d4a29e272f953e12595bf2f04a292dbd (patch)
tree86b54bc29aa126eff797b98728133ea960f8bd01 /include/linux/workqueue.h
parent71d1d5c722db9ae3b3f9c08ef7ddcd7759fbb1e0 (diff)
downloadlinux-3.10-a25909a4d4a29e272f953e12595bf2f04a292dbd.tar.gz
linux-3.10-a25909a4d4a29e272f953e12595bf2f04a292dbd.tar.bz2
linux-3.10-a25909a4d4a29e272f953e12595bf2f04a292dbd.zip
lockdep: Add an in_workqueue_context() lockdep-based test function
Some recent uses of RCU make use of workqueues. In these uses, execution within the context of a specific workqueue takes the place of the usual RCU read-side primitives such as rcu_read_lock(), and flushing of workqueues takes the place of the usual RCU grace-period primitives. Checking for correct use of rcu_dereference() in such cases requires a test of whether the code is executing in the context of a particular workqueue. This commit adds an in_workqueue_context() function that provides this test. This new function is only defined when lockdep is enabled, which allows it to be used as the second argument of rcu_dereference_check(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/workqueue.h')
-rw-r--r--include/linux/workqueue.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 9466e860d8c..d0f7c817849 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -297,4 +297,8 @@ static inline long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg)
#else
long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg);
#endif /* CONFIG_SMP */
+
+#ifdef CONFIG_LOCKDEP
+int in_workqueue_context(struct workqueue_struct *wq);
+#endif
#endif