Skip to content

Commit

Permalink
exit/kthread: Have kernel threads return instead of calling do_exit
Browse files Browse the repository at this point in the history
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/20211020174406.17889-12-ebiederm@xmission.com
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
  • Loading branch information
Eric W. Biederman committed Oct 29, 2021
1 parent 9bc508c commit 111e704
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drivers/firmware/stratix10-svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ static int svc_normal_to_secure_thread(void *data)
* physical address of memory block reserved by secure monitor software at
* secure world.
*
* svc_normal_to_secure_shm_thread() calls do_exit() directly since it is a
* svc_normal_to_secure_shm_thread() terminates directly since it is a
* standlone thread for which no one will call kthread_stop() or return when
* 'kthread_should_stop()' is true.
*/
Expand All @@ -544,7 +544,7 @@ static int svc_normal_to_secure_shm_thread(void *data)
}

complete(&sh_mem->sync_complete);
do_exit(0);
return 0;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion drivers/soc/ti/wkup_m3_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc)
else
m3_ipc_state = m3_ipc;

do_exit(0);
return 0;
}

static int wkup_m3_ipc_probe(struct platform_device *pdev)
Expand Down
5 changes: 1 addition & 4 deletions fs/ocfs2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,10 +1497,7 @@ static int __ocfs2_recovery_thread(void *arg)
if (quota_enabled)
kfree(rm_quota);

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

void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num)
Expand Down
2 changes: 1 addition & 1 deletion kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
* If thread is going to be bound on a particular cpu, give its node
* in @node, to get NUMA affinity for kthread stack, or else give NUMA_NO_NODE.
* When woken, the thread will run @threadfn() with @data as its
* argument. @threadfn() can either call do_exit() directly if it is a
* argument. @threadfn() can either return directly if it is a
* standalone thread for which no one will call kthread_stop(), or
* return when 'kthread_should_stop()' is true (which means
* kthread_stop() has been called). The return value should be zero
Expand Down
2 changes: 1 addition & 1 deletion net/batman-adv/tp_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static int batadv_tp_send(void *arg)

batadv_tp_vars_put(tp_vars);

do_exit(0);
return 0;
}

/**
Expand Down

0 comments on commit 111e704

Please sign in to comment.