Re: [PATCH 1/3] kthread: Remove the flags argument from kernel_thread

Linus Torvalds
2022-06-26T21:21:10Z

On Sun, Jun 26, 2022 at 12:15 PM Eric W. Biederman
<ebiederm@xmission.com> wrote:
>
> As kthreadd never exists it simply does not matter what kind of exit
> it has. So for simplicity make it look like everything else and use
> SIGCHLD.

That "never exists" should be "never exits" ;)

But:

> +pid_t kernel_thread(int (*fn)(void *), void *arg)
> {
> + unsigned long flags = CLONE_FS | CLONE_FILES | SIGCHLD;
> struct kernel_clone_args args = {
> .flags = ((lower_32_bits(flags) | CLONE_VM |
> CLONE_UNTRACED) & ~CSIGNAL),

Please just get rid of that 'flags' thing, and the lower_32_bits()
games and write this all as

pid_t kernel_thread(int (*fn)(void *), void *arg)
{
struct kernel_clone_args args = {
.flags = CLONE_FS | CLONE_FILES |
CLONE_VM | CLONE_UNTRACED,
.exit_signal = SIGCHLD,
...

which does that whole thing much more clearly.

Linus