exit/kthread: Have kernel threads return instead of calling do_exit
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 20 Oct 2021 17:43:58 +0000 (12:43 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 29 Oct 2021 19:31:33 +0000 (14:31 -0500)
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] 63706172f332 ("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>
drivers/firmware/stratix10-svc.c
drivers/soc/ti/wkup_m3_ipc.c
fs/ocfs2/journal.c
kernel/kthread.c
net/batman-adv/tp_meter.c

index 2a7687911c097c964bed2444d45262441f2872e3..29c0a616b317744bcce9771078e1d76abfa206e5 100644 (file)
@@ -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.
  */
@@ -544,7 +544,7 @@ static int svc_normal_to_secure_shm_thread(void *data)
        }
 
        complete(&sh_mem->sync_complete);
-       do_exit(0);
+       return 0;
 }
 
 /**
index 09abd17065ba58c6c5c0920a55eca48e29753bd5..0733443a26312ec3780d6e2ff573ee3f5a2ddcd1 100644 (file)
@@ -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)
index 4f15750aac5d5415fc0be0e5b3826cc7531ad8d4..329986f12db32cc21fadf5984ca86b880552b0e4 100644 (file)
@@ -1497,10 +1497,7 @@ bail:
        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)
index 5b37a8567168b37ae0d67087d75e49020f1986b0..33e17beaa682969cf33f8a71d57c3ccd29fa480f 100644 (file)
@@ -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
index 56b9fe97b3b44cc677c34ca44c859afd26815ed7..1252540cde17937029b0dedfc8fa507dc04afa49 100644 (file)
@@ -890,7 +890,7 @@ out:
 
        batadv_tp_vars_put(tp_vars);
 
-       do_exit(0);
+       return 0;
 }
 
 /**