diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2023-09-08 01:40:48 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-06-12 11:12:52 +0200 |
commit | a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44 (patch) | |
tree | d73c932ab2f3f50ae6a1243909027293870fcd55 /mm | |
parent | 1b5234b2241a229b06d483e0a14b0a0ed1346d6d (diff) | |
download | linux-stable-a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44.tar.gz linux-stable-a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44.tar.bz2 linux-stable-a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44.zip |
kthread: add kthread_stop_put
[ Upstream commit 6309727ef27162deabd5c095c11af24970fba5a2 ]
Add a kthread_stop_put() helper that stops a thread and puts its task
struct. Use it to replace the various instances of kthread_stop()
followed by put_task_struct().
Remove the kthread_stop_put() macro in usbip that is similar but doesn't
return the result of kthread_stop().
[agruenba@redhat.com: fix kerneldoc comment]
Link: https://lkml.kernel.org/r/20230911111730.2565537-1-agruenba@redhat.com
[akpm@linux-foundation.org: document kthread_stop_put()'s argument]
Link: https://lkml.kernel.org/r/20230907234048.2499820-1-agruenba@redhat.com
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Stable-dep-of: bb9025f4432f ("dma-mapping: benchmark: fix up kthread-related error handling")
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/damon/core.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c index aff611b6eafe..38e206075143 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -708,8 +708,7 @@ static int __damon_stop(struct damon_ctx *ctx) if (tsk) { get_task_struct(tsk); mutex_unlock(&ctx->kdamond_lock); - kthread_stop(tsk); - put_task_struct(tsk); + kthread_stop_put(tsk); return 0; } mutex_unlock(&ctx->kdamond_lock); |