From: Dmitry Antipov <dmitry.antipov@linaro.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Module/kthread/printk question/problem
Date: Thu, 02 Feb 2012 13:20:18 +0400 [thread overview]
Message-ID: <4F2A5552.70302@linaro.org> (raw)
In-Reply-To: <1328168701.2902.14.camel@edumazet-laptop>
On 02/02/2012 11:45 AM, Eric Dumazet wrote:
> Remove the wait_for_completion(), this brings nothing at all, as you
> already discovered.
I want to get the module 'locked' until all threads are completed.
> Then you need cooperation from worker threads : they must wait for
> kthread_should_stop(), or else your kthread_stop(arg) pass an already
> freed "arg" memory block.
I designed the cooperation in another way: after each successful call
of X = kthread_run(...), I do get_task_struct(X), and the module exit
code is something like:
...
wait_for_completion(&done);
for (i = 0; i < nrthreads; i++) {
kthread_stop(threads[i]);
put_task_struct(threads[i]);
}
kfree(threads);
...
The crash is go away, so I believe this is reasonable. Anyway, it would
be nice to have a debug option to detect such a suspicious errors.
Thanks,
Dmitry
next prev parent reply other threads:[~2012-02-02 9:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-01 16:09 Module/kthread/printk question/problem Dmitry Antipov
2012-02-01 16:31 ` Eric Dumazet
2012-02-01 16:35 ` Dmitry Antipov
2012-02-01 17:16 ` Eric Dumazet
2012-02-02 6:13 ` Dmitry Antipov
2012-02-02 7:45 ` Eric Dumazet
2012-02-02 9:20 ` Dmitry Antipov [this message]
2012-02-02 9:15 ` Eric Dumazet
2012-02-02 9:22 ` Dmitry Antipov
2012-02-02 9:58 ` Eric Dumazet
2012-02-06 23:43 ` Rusty Russell
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=4F2A5552.70302@linaro.org \
--to=dmitry.antipov@linaro.org \
--cc=eric.dumazet@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.