kthread.c (c900529f3d9161bfde5cca0754f83b4d3c3e0220) kthread.c (a9da6ddaef9ef7d9afd3f89e447c60e38f74bf44)
1// SPDX-License-Identifier: GPL-2.0-only
2/* Kernel thread helper functions.
3 * Copyright (C) 2004 IBM Corporation, Rusty Russell.
4 * Copyright (C) 2009 Red Hat, Inc.
5 *
6 * Creation is done via kthreadd, so that we get a clean environment
7 * even if we're invoked from userspace (think modprobe, hotplug cpu,
8 * etc.).

--- 701 unchanged lines hidden (view full) ---

710 ret = kthread->result;
711 put_task_struct(k);
712
713 trace_sched_kthread_stop_ret(ret);
714 return ret;
715}
716EXPORT_SYMBOL(kthread_stop);
717
1// SPDX-License-Identifier: GPL-2.0-only
2/* Kernel thread helper functions.
3 * Copyright (C) 2004 IBM Corporation, Rusty Russell.
4 * Copyright (C) 2009 Red Hat, Inc.
5 *
6 * Creation is done via kthreadd, so that we get a clean environment
7 * even if we're invoked from userspace (think modprobe, hotplug cpu,
8 * etc.).

--- 701 unchanged lines hidden (view full) ---

710 ret = kthread->result;
711 put_task_struct(k);
712
713 trace_sched_kthread_stop_ret(ret);
714 return ret;
715}
716EXPORT_SYMBOL(kthread_stop);
717
718/**
719 * kthread_stop_put - stop a thread and put its task struct
720 * @k: thread created by kthread_create().
721 *
722 * Stops a thread created by kthread_create() and put its task_struct.
723 * Only use when holding an extra task struct reference obtained by
724 * calling get_task_struct().
725 */
726int kthread_stop_put(struct task_struct *k)
727{
728 int ret;
729
730 ret = kthread_stop(k);
731 put_task_struct(k);
732 return ret;
733}
734EXPORT_SYMBOL(kthread_stop_put);
735
718int kthreadd(void *unused)
719{
720 struct task_struct *tsk = current;
721
722 /* Setup a clean context for our children to inherit. */
723 set_task_comm(tsk, "kthreadd");
724 ignore_signals(tsk);
725 set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_TYPE_KTHREAD));

--- 809 unchanged lines hidden ---
736int kthreadd(void *unused)
737{
738 struct task_struct *tsk = current;
739
740 /* Setup a clean context for our children to inherit. */
741 set_task_comm(tsk, "kthreadd");
742 ignore_signals(tsk);
743 set_cpus_allowed_ptr(tsk, housekeeping_cpumask(HK_TYPE_KTHREAD));

--- 809 unchanged lines hidden ---