From eaf7ef96b9a75e66c3e039951a2ebcc708bc672a Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Thu, 13 May 2010 12:32:28 -0700 Subject: [PATCH] --- yaml --- r: 205222 b: refs/heads/master c: a25909a4d4a29e272f953e12595bf2f04a292dbd h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/workqueue.h | 4 ++++ trunk/kernel/workqueue.c | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 84dff56ddb3a..508ced94aeb6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 71d1d5c722db9ae3b3f9c08ef7ddcd7759fbb1e0 +refs/heads/master: a25909a4d4a29e272f953e12595bf2f04a292dbd diff --git a/trunk/include/linux/workqueue.h b/trunk/include/linux/workqueue.h index 9466e860d8c2..d0f7c8178498 100644 --- a/trunk/include/linux/workqueue.h +++ b/trunk/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 diff --git a/trunk/kernel/workqueue.c b/trunk/kernel/workqueue.c index 327d2deb4451..59fef1531dd2 100644 --- a/trunk/kernel/workqueue.c +++ b/trunk/kernel/workqueue.c @@ -68,6 +68,21 @@ struct workqueue_struct { #endif }; +#ifdef CONFIG_LOCKDEP +/** + * in_workqueue_context() - in context of specified workqueue? + * @wq: the workqueue of interest + * + * Checks lockdep state to see if the current task is executing from + * within a workqueue item. This function exists only if lockdep is + * enabled. + */ +int in_workqueue_context(struct workqueue_struct *wq) +{ + return lock_is_held(&wq->lockdep_map); +} +#endif + #ifdef CONFIG_DEBUG_OBJECTS_WORK static struct debug_obj_descr work_debug_descr;