From: Mike Christie <michael.christie@oracle.com>
To: brauner@kernel.org, ebiederm@xmission.com,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Mike Christie <michael.christie@oracle.com>
Subject: [PATCH 5/5] kernel: Convert kthread to use setup_thread_fn
Date: Sun, 12 Feb 2023 19:00:20 -0600 [thread overview]
Message-ID: <20230213010020.1813-6-michael.christie@oracle.com> (raw)
In-Reply-To: <20230213010020.1813-1-michael.christie@oracle.com>
kthread_setup_struct can now setup the kthread struct and setup the
comm, so remove the call to kthread_setup_struct in copy_process and
have kthread.c set the setup_thread_fn callback, so it works like
io_uring.
Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
kernel/fork.c | 5 +----
kernel/kthread.c | 1 +
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index bd60ecc6b29c..7cdd85befa41 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2189,10 +2189,6 @@ static __latent_entropy struct task_struct *copy_process(
p->io_context = NULL;
audit_set_context(p, NULL);
cgroup_fork(p);
- if (args->kthread) {
- if (kthread_setup_struct(p, args->fn_arg))
- goto bad_fork_cleanup_delayacct;
- }
#ifdef CONFIG_NUMA
p->mempolicy = mpol_dup(p->mempolicy);
if (IS_ERR(p->mempolicy)) {
@@ -2598,6 +2594,7 @@ struct task_struct * __init fork_idle(int cpu)
struct task_struct *task;
struct kernel_clone_fns fns = {
.thread_fn = &idle_dummy,
+ .setup_thread_fn = kthread_setup_struct,
};
struct kernel_clone_args args = {
.flags = CLONE_VM,
diff --git a/kernel/kthread.c b/kernel/kthread.c
index b67c2caf2ccb..7776d19789f6 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -429,6 +429,7 @@ int tsk_fork_get_node(struct task_struct *tsk)
static struct kernel_clone_fns thread_clone_fns = {
.thread_fn = kthread,
+ .setup_thread_fn = kthread_setup_struct,
};
static void create_kthread(struct kthread_create_info *create)
--
2.25.1
next prev parent reply other threads:[~2023-02-13 1:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-13 1:00 [PATCH 0/5] kernel: Standardize task comm setup for kthreads Mike Christie
2023-02-13 1:00 ` [PATCH 1/5] kernel: Move kernel_clone_args's fn to new struct Mike Christie
2023-02-13 3:30 ` kernel test robot
2023-02-13 5:28 ` kernel test robot
2023-02-13 19:57 ` Linus Torvalds
2023-02-13 1:00 ` [PATCH 2/5] kernel: Add kernel_clone_fns function to setup task Mike Christie
2023-02-13 1:00 ` [PATCH 3/5] io_uring: Convert to use setup_thread_fn callout Mike Christie
2023-02-13 1:00 ` [PATCH 4/5] kernel: Prepare set_kthread_struct to be used for setup_thread_fn Mike Christie
2023-02-13 19:54 ` Linus Torvalds
2023-02-14 0:50 ` Mike Christie
2023-02-14 18:00 ` Linus Torvalds
2023-02-13 1:00 ` Mike Christie [this message]
2023-02-13 3:41 ` [PATCH 5/5] kernel: Convert kthread to use setup_thread_fn kernel test robot
2023-02-13 3:41 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230213010020.1813-6-michael.christie@oracle.com \
--to=michael.christie@oracle.com \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®