mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aritz Bastida <aritzbastida@gmail.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Stopping Kernel Threads at module unload time
Date: Wed, 9 Nov 2005 18:54:26 +0100	[thread overview]
Message-ID: <7d40d7190511090954u16ba0d65s@mail.gmail.com> (raw)
In-Reply-To: <7d40d7190511090949xc550b68k@mail.gmail.com>

Thank you very much Arnd!
You solved my problem. hehe

I began to write a test module for showing you this and have just
realized about the problem. As I create as many threads as CPUs, I
have to delete them all when finishing.

I killed them like this:

        /* We don't need the distraction of CPUs appearing and vanishing. */
        lock_cpu_hotplug();
        for_each_online_cpu(cpu) {
                p = per_cpu(ksensord_info, cpu);
                kthread_stop(p);
        }
        unlock_cpu_hotplug();

I locked the cpu hotplug lock to protect the for_each_online_cpu()
code in case a cpu appears/vanishes, so I am actually calling
kthread_stop() in an atomic context, so it wakes up the process, but
dont let it run!

This is quite a subtle error, but of course it's my complete fault :P
May be a BUG_ON(in_atomic()) within kthread_stop() would let this kind of
errors be acknowledged more easily.

Thank you for your help
Regards

Aritz Bastida

PS:  Sorry Arnd, I forgot adding the linux-kernel address to the message

  reply	other threads:[~2005-11-09 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 15:49 Aritz Bastida
2005-11-09 16:16 ` linux-os (Dick Johnson)
2005-11-09 16:56   ` Aritz Bastida
2005-11-09 17:05     ` linux-os (Dick Johnson)
2005-11-09 17:24       ` Aritz Bastida
2005-11-09 18:09         ` linux-os (Dick Johnson)
2005-11-09 17:27     ` Arnd Bergmann
2005-11-09 17:49       ` Aritz Bastida
2005-11-09 17:54         ` Aritz Bastida [this message]
2005-11-09 18:10         ` linux-os (Dick Johnson)

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=7d40d7190511090954u16ba0d65s@mail.gmail.com \
    --to=aritzbastida@gmail.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®