From: Petr Mladek <pmladek@suse.com>
To: qiang.zhang@windriver.com
Cc: tj@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] kernel/kthread.c: kthread_worker: add work status check in timer_fn
Date: Fri, 25 Sep 2020 11:30:46 +0200 [thread overview]
Message-ID: <20200925093046.GM29288@alley> (raw)
In-Reply-To: <20200925050759.20805-1-qiang.zhang@windriver.com>
On Fri 2020-09-25 13:07:59, qiang.zhang@windriver.com wrote:
> From: Zqiang <qiang.zhang@windriver.com>
>
> When queue delayed work to worker, at some point after that the timer_fn
> will be call, add work to worker's work_list, at this time, the work may
> be cancel, so add "work->canceling" check current work status.
Great catch!
I was able to understand the problem from the description. Though I
would still try to improve it a bit. I suggest:
<new_text>
Subject: kthread_worker: Prevent queuing delayed work from timer_fn when it is being canceled
There is a small race window when a delayed work is being canceled and
the work still might be queued from the timer_fn:
CPU0 CPU1
kthread_cancel_delayed_work_sync()
__kthread_cancel_work_sync()
__kthread_cancel_work()
work->canceling++;
kthread_delayed_work_timer_fn()
kthread_insert_work();
BUG: kthread_insert_work() should not get called when work->canceling
is set.
</new_text>
> Signed-off-by: Zqiang <qiang.zhang@windriver.com>
With the above subject and commit message:
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
next prev parent reply other threads:[~2020-09-25 9:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-25 5:07 qiang.zhang
2020-09-25 9:30 ` Petr Mladek [this message]
[not found] ` <20200925123821.18556-1-hdanton@sina.com>
2020-09-25 13:16 ` Petr Mladek
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=20200925093046.GM29288@alley \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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®