2020-07-03 08:50:50

by Zhang, Qiang

[permalink] [raw]
Subject: [PATCH v2] kthread: work could not be queued when worker being destroyed

From: Zhang Qiang <[email protected]>

The "queuing_blocked" func should print warning message and
returns true when the worker being destroyed.

Suggested-by: Petr Mladek <[email protected]>
Signed-off-by: Zhang Qiang <[email protected]>
---
v1->v2:
Add warning information for condition "!worker->task"

kernel/kthread.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index bfbfa481be3a..cac5184ffd86 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -791,6 +791,9 @@ static inline bool queuing_blocked(struct kthread_worker *worker,
{
lockdep_assert_held(&worker->lock);

+ if (WARN_ON(!worker->task))
+ return true;
+
return !list_empty(&work->node) || work->canceling;
}

--
2.24.1


2020-07-03 11:12:03

by Petr Mladek

[permalink] [raw]
Subject: Re: [PATCH v2] kthread: work could not be queued when worker being destroyed

On Thu 2020-07-02 15:01:56, [email protected] wrote:
> From: Zhang Qiang <[email protected]>
>
> The "queuing_blocked" func should print warning message and
> returns true when the worker being destroyed.
>
> Suggested-by: Petr Mladek <[email protected]>
> Signed-off-by: Zhang Qiang <[email protected]>

Looks good to me.

Reviewed-by: Petr Mladek <[email protected]>

Adding Andrew into CC. Changes in kernel/kthread.c usually goes
through him. You might need to resend the patch once again
with Andrew in CC.

Best Regards,
Petr Mladek

2020-07-03 19:15:48

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH v2] kthread: work could not be queued when worker being destroyed

On Thu, 2 Jul 2020 15:01:56 +0800 <[email protected]> wrote:

> From: Zhang Qiang <[email protected]>
>
> The "queuing_blocked" func should print warning message and
> returns true when the worker being destroyed.

Why should it do this?

Please prepare a changelog which contains much more information.