public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* workqueue - process context
@ 2005-02-19  1:48 Vicente Feito
  2005-02-19  4:57 ` Roland Dreier
  0 siblings, 1 reply; 8+ messages in thread
From: Vicente Feito @ 2005-02-19  1:48 UTC (permalink / raw)
  To: Linux Kernel Mailing List

I've been playing with workqueues, and I've found that once I unload the 
module, if I don't call destroy_workqueue(); then the workqueue I've created 
stays in the process list, [my_wq], I don't know if that's meant to be, or is 
it a bug, cause I believe there can be two options in here:

1) It's meant to be so you can unload your module and let the works run some 
time after you're already gone, that allows you to probe other modules or do 
whatever necesary without the need to wait for the workqueue to be emtpy.

2) It's a bug, cause the module allows to be unloaded, destroying the structs 
but not removing the workqueue from the process context.

Which one is it?I hope I'm being clear with my question.
I was about to try to find a solution to remove the queue but maybe it's meant 
to be, although not likely.

Vicente.

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: workqueue - process context
@ 2005-02-19  2:38 Vicente Feito
  0 siblings, 0 replies; 8+ messages in thread
From: Vicente Feito @ 2005-02-19  2:38 UTC (permalink / raw)
  To: Linux Kernel Mailing List

On Saturday 19 February 2005 04:57 am, you wrote:
>     Vicente> I've been playing with workqueues, and I've found that
>     Vicente> once I unload the module, if I don't call
>     Vicente> destroy_workqueue(); then the workqueue I've created
>     Vicente> stays in the process list, [my_wq], I don't know if
>     Vicente> that's meant to be, or is it a bug, cause I believe there
>     Vicente> can be two options in here:
>
>     Vicente> 1) It's meant to be so you can unload your module and let
>     Vicente> the works run some time after you're already gone, that
>     Vicente> allows you to probe other modules or do whatever necesary
>     Vicente> without the need to wait for the workqueue to be emtpy.
>
>     Vicente> 2) It's a bug, cause the module allows to be unloaded,
>     Vicente> destroying the structs but not removing the workqueue
>     Vicente> from the process context.
>
> Not destroying its workqueue is a bug in the module just like any
> other resource leak.  It's analogous to a module allocating some
> memory with kmalloc() and not calling kfree() when it's unloaded.  If
> a module creates a workqueue, then it should call destroy_workqueue()
> when it's unloaded.
What if I need the module to be unloaded cause It's mutually exclusive with 
another module to be loaded, and I still need to run the works in a workqueue 
time before that happens? That's completely out of the picture?cause that 
might be useful.
>
> By the way, the module (or any code calling destroy_workqueue()) must
> make sure that it has race conditions that might result in work being
> submitted to the queue while it is being destroyed.
yes, I think flushing is enough, is it?

>
>  -R .
Vicente.

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

end of thread, other threads:[~2005-02-19 16:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-19  1:48 workqueue - process context Vicente Feito
2005-02-19  4:57 ` Roland Dreier
2005-02-19  2:02   ` Vicente Feito
2005-02-19  5:03     ` Roland Dreier
2005-02-19 14:31   ` Rene Herman
2005-02-19 16:19     ` Roland Dreier
2005-02-19 16:52       ` Rene Herman
  -- strict thread matches above, loose matches on Subject: below --
2005-02-19  2:38 Vicente Feito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox