Re: [PATCH V2 2/9] fork: pass worker_flags to copy_thread

From: Christian Brauner
Date: Wed Sep 22 2021 - 08:42:52 EST


On Tue, Sep 21, 2021 at 04:52:11PM -0500, Mike Christie wrote:
> We need to break up PF_IO_WORKER into the parts that are used for
> scheduling and signal handling and the part that tells copy_thread to
> treat it as a special type of thread during setup. This patch passes the
> worker_flags to copy_thread, so in the next patch we can add new worker
> flags that function can see.
>
> Signed-off-by: Mike Christie <michael.christie@xxxxxxxxxx>
> ---
> arch/alpha/kernel/process.c | 2 +-
> arch/arc/kernel/process.c | 2 +-
> arch/arm/kernel/process.c | 3 ++-
> arch/arm64/kernel/process.c | 3 ++-
> arch/csky/kernel/process.c | 3 ++-
> arch/h8300/kernel/process.c | 3 ++-
> arch/hexagon/kernel/process.c | 2 +-
> arch/ia64/kernel/process.c | 3 ++-
> arch/m68k/kernel/process.c | 2 +-
> arch/microblaze/kernel/process.c | 2 +-
> arch/mips/kernel/process.c | 2 +-
> arch/nds32/kernel/process.c | 3 ++-
> arch/nios2/kernel/process.c | 2 +-
> arch/openrisc/kernel/process.c | 3 ++-
> arch/parisc/kernel/process.c | 3 ++-
> arch/powerpc/kernel/process.c | 2 +-
> arch/riscv/kernel/process.c | 2 +-
> arch/s390/kernel/process.c | 3 ++-
> arch/sh/kernel/process_32.c | 2 +-
> arch/sparc/kernel/process_32.c | 2 +-
> arch/sparc/kernel/process_64.c | 2 +-
> arch/um/kernel/process.c | 3 ++-
> arch/x86/kernel/process.c | 2 +-
> arch/xtensa/kernel/process.c | 2 +-
> include/linux/sched/task.h | 2 +-
> kernel/fork.c | 3 ++-
> 26 files changed, 37 insertions(+), 26 deletions(-)
>
> diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
> index a5123ea426ce..6005b0dfe7e2 100644
> --- a/arch/alpha/kernel/process.c
> +++ b/arch/alpha/kernel/process.c
> @@ -235,7 +235,7 @@ release_thread(struct task_struct *dead_task)
> */
> int copy_thread(unsigned long clone_flags, unsigned long usp,
> unsigned long kthread_arg, struct task_struct *p,
> - unsigned long tls)
> + unsigned long tls, u32 worker_flags)

After I unified all of those calls across all arches I think we should
start thinking about a way to maybe have a substruct
struct copy_thread
or something to encompass this information that gets passed to
copy_thread() instead of individual arguments.
struct copy_thread
would just contain the information all the arches need and nothing more.
That's better than passing all of
struct kernel_clone_args
imho. But that's a separate cleanup I had in mind for a while and is
unrelated to your patch.
I think it's fine to do it this way for now.

Acked-by: Christian Brauner <christian.brauner@xxxxxxxxxx>