linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC] workqueue: remove in_workqueue_context()
@ 2010-09-23 12:35 Tejun Heo
  2010-09-23 17:10 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2010-09-23 12:35 UTC (permalink / raw)
  To: lkml, Paul E. McKenney

Commit a25909a4 (lockdep: Add an in_workqueue_context() lockdep-based
test function) added in_workqueue_context() but there hasn't been any
in-kernel user and the lockdep annotation in workqueue is scheduled to
change.  Remove the unused function.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
Paul, I was looking through lockdep annotations to see how they can be
improved and noticed that in_workqueue_context() isn't used by anyone
and it seems like there hasn't been any in-kernel user either.  Can
this be removed or do you expect to use it somewhere?

Thanks.

 include/linux/workqueue.h |    4 ----
 kernel/workqueue.c        |   15 ---------------
 2 files changed, 19 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index e33ff4a..f6eaf56 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -429,8 +429,4 @@ extern bool freeze_workqueues_busy(void);
 extern void thaw_workqueues(void);
 #endif /* CONFIG_FREEZER */

-#ifdef CONFIG_LOCKDEP
-int in_workqueue_context(struct workqueue_struct *wq);
-#endif
-
 #endif
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 19e4bc1..c758e78 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -310,21 +310,6 @@ static inline int __next_wq_cpu(int cpu, const struct cpumask *mask,
 	     (cpu) < WORK_CPU_NONE;					\
 	     (cpu) = __next_wq_cpu((cpu), cpu_possible_mask, (wq)))

-#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;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] workqueue: remove in_workqueue_context()
  2010-09-23 12:35 [PATCH RFC] workqueue: remove in_workqueue_context() Tejun Heo
@ 2010-09-23 17:10 ` Paul E. McKenney
  2010-10-15 14:48   ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2010-09-23 17:10 UTC (permalink / raw)
  To: Tejun Heo; +Cc: lkml, mst

On Thu, Sep 23, 2010 at 02:35:07PM +0200, Tejun Heo wrote:
> Commit a25909a4 (lockdep: Add an in_workqueue_context() lockdep-based
> test function) added in_workqueue_context() but there hasn't been any
> in-kernel user and the lockdep annotation in workqueue is scheduled to
> change.  Remove the unused function.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> Paul, I was looking through lockdep annotations to see how they can be
> improved and noticed that in_workqueue_context() isn't used by anyone
> and it seems like there hasn't been any in-kernel user either.  Can
> this be removed or do you expect to use it somewhere?

I added it for the drivers/vhost changes.  They were using a
variant of RCU where executing in workqueue context acted as an RCU
read-side critical section and where flushing workqueues acted as
an RCU grace period.  The in_workqueue_context() was then passed to
rcu_dereference_check() to verify correct usage.

But you are right, I don't see it being used any more, though I do still
see the big block comment documenting this in drivers/vhost/vhost.h.

Michael, what are Tejun and I missing here?

							Thanx, Paul

> Thanks.
> 
>  include/linux/workqueue.h |    4 ----
>  kernel/workqueue.c        |   15 ---------------
>  2 files changed, 19 deletions(-)
> 
> diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
> index e33ff4a..f6eaf56 100644
> --- a/include/linux/workqueue.h
> +++ b/include/linux/workqueue.h
> @@ -429,8 +429,4 @@ extern bool freeze_workqueues_busy(void);
>  extern void thaw_workqueues(void);
>  #endif /* CONFIG_FREEZER */
> 
> -#ifdef CONFIG_LOCKDEP
> -int in_workqueue_context(struct workqueue_struct *wq);
> -#endif
> -
>  #endif
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 19e4bc1..c758e78 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -310,21 +310,6 @@ static inline int __next_wq_cpu(int cpu, const struct cpumask *mask,
>  	     (cpu) < WORK_CPU_NONE;					\
>  	     (cpu) = __next_wq_cpu((cpu), cpu_possible_mask, (wq)))
> 
> -#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;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] workqueue: remove in_workqueue_context()
  2010-09-23 17:10 ` Paul E. McKenney
@ 2010-10-15 14:48   ` Tejun Heo
  2010-10-19  9:27     ` Tejun Heo
  0 siblings, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2010-10-15 14:48 UTC (permalink / raw)
  To: paulmck; +Cc: lkml, mst

On 09/23/2010 07:10 PM, Paul E. McKenney wrote:
> On Thu, Sep 23, 2010 at 02:35:07PM +0200, Tejun Heo wrote:
>> Commit a25909a4 (lockdep: Add an in_workqueue_context() lockdep-based
>> test function) added in_workqueue_context() but there hasn't been any
>> in-kernel user and the lockdep annotation in workqueue is scheduled to
>> change.  Remove the unused function.
>>
>> Signed-off-by: Tejun Heo <tj@kernel.org>
>> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>> ---
>> Paul, I was looking through lockdep annotations to see how they can be
>> improved and noticed that in_workqueue_context() isn't used by anyone
>> and it seems like there hasn't been any in-kernel user either.  Can
>> this be removed or do you expect to use it somewhere?
> 
> I added it for the drivers/vhost changes.  They were using a
> variant of RCU where executing in workqueue context acted as an RCU
> read-side critical section and where flushing workqueues acted as
> an RCU grace period.  The in_workqueue_context() was then passed to
> rcu_dereference_check() to verify correct usage.
> 
> But you are right, I don't see it being used any more, though I do still
> see the big block comment documenting this in drivers/vhost/vhost.h.
> 
> Michael, what are Tejun and I missing here?

Ping.  Shall I go forward with this patch?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH RFC] workqueue: remove in_workqueue_context()
  2010-10-15 14:48   ` Tejun Heo
@ 2010-10-19  9:27     ` Tejun Heo
  0 siblings, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2010-10-19  9:27 UTC (permalink / raw)
  To: paulmck; +Cc: lkml, mst

On 10/15/2010 04:48 PM, Tejun Heo wrote:
>> I added it for the drivers/vhost changes.  They were using a
>> variant of RCU where executing in workqueue context acted as an RCU
>> read-side critical section and where flushing workqueues acted as
>> an RCU grace period.  The in_workqueue_context() was then passed to
>> rcu_dereference_check() to verify correct usage.
>>
>> But you are right, I don't see it being used any more, though I do still
>> see the big block comment documenting this in drivers/vhost/vhost.h.
>>
>> Michael, what are Tejun and I missing here?
> 
> Ping.  Shall I go forward with this patch?

Applied to wq#for-next.  Scream if this should be reverted.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-19  9:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 12:35 [PATCH RFC] workqueue: remove in_workqueue_context() Tejun Heo
2010-09-23 17:10 ` Paul E. McKenney
2010-10-15 14:48   ` Tejun Heo
2010-10-19  9:27     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).