summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAndreas Gruenbacher <agruenba@redhat.com>2023-09-08 02:40:48 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-12 12:12:52 +0300
commita9da6ddaef9ef7d9afd3f89e447c60e38f74bf44 (patch)
treed73c932ab2f3f50ae6a1243909027293870fcd55 /net
parent1b5234b2241a229b06d483e0a14b0a0ed1346d6d (diff)
downloadlinux-a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44.tar.xz
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 'net')
-rw-r--r--net/core/pktgen.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 4d1696677c48..0e472f6fab85 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3982,8 +3982,7 @@ static void __net_exit pg_net_exit(struct net *net)
list_for_each_safe(q, n, &list) {
t = list_entry(q, struct pktgen_thread, th_list);
list_del(&t->th_list);
- kthread_stop(t->tsk);
- put_task_struct(t->tsk);
+ kthread_stop_put(t->tsk);
kfree(t);
}