lkml.org 
[lkml]   [2020]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject回复: [PATCH] kthread: Don't cancel a work th at is being cancelled
Date
Thank you for your advice,   if add kthread_cancel_work() without the "_sync"
it is be dangerous, But I think it is unnecessary to cancel work which is be canceling.
________________________________________
发件人: linux-kernel-owner@vger.kernel.org <linux-kernel-owner@vger.kernel.org> 代表 Petr Mladek <pmladek@suse.com>
发送时间: 2020年7月3日 15:28
收件人: Zhang, Qiang
抄送: ben.dooks@codethink.co.uk; bfields@redhat.com; cl@rock-chips.com; peterz@infradead.org; tj@kernel.org; linux-kernel@vger.kernel.org
主题: Re: [PATCH] kthread: Don't cancel a work that is being cancelled

On Thu 2020-07-02 12:43:24, qiang.zhang@windriver.com wrote:
> From: Zhang Qiang <qiang.zhang@windriver.com>
>
> When canceling a work, if it is found that the work is in
> the cancelling state, we should directly exit the cancelled
> operation.

No, the function guarantees that the work is not longer running
when it returns. This is why it has the suffix "_sync" in the name.

We would need to add kthread_cancel_work() without the "_sync"
wrappers that would not wait for the work in progress. But it
might be dangerous. The API users usually want to make sure
that the work in not longer running to avoid races.

What is the use case for the non-sync behavior, please?

Best Regards,
Petr
\
 
 \ /
  Last update: 2020-07-03 10:58    [W:0.070 / U:0.800 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site