From: Petr Mladek <pmladek@suse.com>
To: qiang.zhang@windriver.com
Cc: ben.dooks@codethink.co.uk, bfields@redhat.com, cl@rock-chips.com,
peterz@infradead.org, tj@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kthread: work could not be queued when worker being destroyed
Date: Fri, 3 Jul 2020 10:11:36 +0200 [thread overview]
Message-ID: <20200703081136.GD11587@alley> (raw)
In-Reply-To: <20200702044946.33142-1-qiang.zhang@windriver.com>
On Thu 2020-07-02 12:49:46, qiang.zhang@windriver.com wrote:
> From: Zhang Qiang <qiang.zhang@windriver.com>
>
> The queuing_blocked func should returns true when the worker
> being destroyed.
Queuing work when the worker is not running usually means
a bad design on the API user side. The work is never done
and some job has not finished correctly. We should not go
over it quietly.
> Signed-off-by: Zhang Qiang <qiang.zhang@windriver.com>
> ---
> kernel/kthread.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 1166f2043e67..2ca711d0e78a 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -791,7 +791,7 @@ static inline bool queuing_blocked(struct kthread_worker *worker,
> {
> lockdep_assert_held(&worker->lock);
A better solution would be:
if (WARN_ON(!worker->task)
return true;
> - return !list_empty(&work->node) || work->canceling;
> + return !list_empty(&work->node) || work->canceling || !worker->task;
> }
>
> static void kthread_insert_work_sanity_check(struct kthread_worker *worker,
Best Regards,
Petr
prev parent reply other threads:[~2020-07-03 8:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 4:49 qiang.zhang
2020-07-03 8:11 ` Petr Mladek [this message]
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=20200703081136.GD11587@alley \
--to=pmladek@suse.com \
--cc=ben.dooks@codethink.co.uk \
--cc=bfields@redhat.com \
--cc=cl@rock-chips.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=qiang.zhang@windriver.com \
--cc=tj@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®