Skip to content

Commit 111e704

Browse files
committed
exit/kthread: Have kernel threads return instead of calling do_exit
In 2009 Oleg reworked[1] the kernel threads so that it is not necessary to call do_exit if you are not using kthread_stop(). Remove the explicit calls of do_exit and complete_and_exit (with a NULL completion) that were previously necessary. [1] 6370617 ("kthreads: rework kthread_stop()") Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Eric W. Biederman <[email protected]>
1 parent 9bc508c commit 111e704

File tree

5 files changed

+6
-9
lines changed

5 files changed

+6
-9
lines changed

drivers/firmware/stratix10-svc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ static int svc_normal_to_secure_thread(void *data)
520520
* physical address of memory block reserved by secure monitor software at
521521
* secure world.
522522
*
523-
* svc_normal_to_secure_shm_thread() calls do_exit() directly since it is a
523+
* svc_normal_to_secure_shm_thread() terminates directly since it is a
524524
* standlone thread for which no one will call kthread_stop() or return when
525525
* 'kthread_should_stop()' is true.
526526
*/
@@ -544,7 +544,7 @@ static int svc_normal_to_secure_shm_thread(void *data)
544544
}
545545

546546
complete(&sh_mem->sync_complete);
547-
do_exit(0);
547+
return 0;
548548
}
549549

550550
/**

drivers/soc/ti/wkup_m3_ipc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
426426
else
427427
m3_ipc_state = m3_ipc;
428428

429-
do_exit(0);
429+
return 0;
430430
}
431431

432432
static int wkup_m3_ipc_probe(struct platform_device *pdev)

fs/ocfs2/journal.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,10 +1497,7 @@ static int __ocfs2_recovery_thread(void *arg)
14971497
if (quota_enabled)
14981498
kfree(rm_quota);
14991499

1500-
/* no one is callint kthread_stop() for us so the kthread() api
1501-
* requires that we call do_exit(). And it isn't exported, but
1502-
* complete_and_exit() seems to be a minimal wrapper around it. */
1503-
complete_and_exit(NULL, status);
1500+
return status;
15041501
}
15051502

15061503
void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)

kernel/kthread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
433433
* If thread is going to be bound on a particular cpu, give its node
434434
* in @node, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.
435435
* When woken, the thread will run @threadfn() with @data as its
436-
* argument. @threadfn() can either call do_exit() directly if it is a
436+
* argument. @threadfn() can either return directly if it is a
437437
* standalone thread for which no one will call kthread_stop(), or
438438
* return when 'kthread_should_stop()' is true (which means
439439
* kthread_stop() has been called). The return value should be zero

net/batman-adv/tp_meter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ static int batadv_tp_send(void *arg)
890890

891891
batadv_tp_vars_put(tp_vars);
892892

893-
do_exit(0);
893+
return 0;
894894
}
895895

896896
/**

0 commit comments

Comments
 (0)