public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <roland@topspin.com>
To: Vicente Feito <vicente.feito@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: workqueue - process context
Date: Fri, 18 Feb 2005 20:57:11 -0800	[thread overview]
Message-ID: <52is4ptae0.fsf@topspin.com> (raw)
In-Reply-To: <200502190148.11334.vicente.feito@gmail.com> (Vicente Feito's message of "Sat, 19 Feb 2005 01:48:11 +0000")

    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.

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.

 -R .

  reply	other threads:[~2005-02-19  4:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-19  1:48 workqueue - process context Vicente Feito
2005-02-19  4:57 ` Roland Dreier [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52is4ptae0.fsf@topspin.com \
    --to=roland@topspin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vicente.feito@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox