[PATCH] um: move thread info into task
Hajime Tazaki
thehajime at gmail.com
Fri Nov 8 17:03:46 PST 2024
On Fri, 08 Nov 2024 18:08:26 +0900,
Benjamin Berg wrote:
> diff --git a/arch/um/include/asm/current.h b/arch/um/include/asm/current.h
> new file mode 100644
> index 000000000000..51b9c4d097e7
> --- /dev/null
> +++ b/arch/um/include/asm/current.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __ASM_CURRENT_H
> +#define __ASM_CURRENT_H
> +
> +#include <linux/compiler.h>
> +#include <linux/threads.h>
> +
> +#ifndef __ASSEMBLY__
> +
> +struct task_struct;
> +extern struct task_struct * cpu_tasks[NR_CPUS];
might be
extern struct task_struct *cpu_tasks[NR_CPUS];
# no space before the variable.
> +static __always_inline struct task_struct *get_current(void)
> +{
> + return cpu_tasks[0];
> +}
> +
(snip)
> diff --git a/arch/um/include/shared/as-layout.h b/arch/um/include/shared/as-layout.h
> index d9679c911e54..0d3f5d022d24 100644
> --- a/arch/um/include/shared/as-layout.h
> +++ b/arch/um/include/shared/as-layout.h
> @@ -30,11 +30,8 @@
>
> #include <sysdep/ptrace.h>
>
> -struct cpu_task {
> - void *task;
> -};
> -
> -extern struct cpu_task cpu_tasks[];
> +struct task_struct;
> +extern struct task_struct * cpu_tasks[];
ditto.
> extern unsigned long long physmem_size;
>
> diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
(snip)
> diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
> index 56e7e525fc91..5283035fb655 100644
> --- a/arch/um/kernel/process.c
> +++ b/arch/um/kernel/process.c
> @@ -43,7 +43,8 @@
> * cares about its entry, so it's OK if another processor is modifying its
> * entry.
> */
> -struct cpu_task cpu_tasks[NR_CPUS] = { [0 ... NR_CPUS - 1] = { NULL } };
> +struct task_struct * cpu_tasks[NR_CPUS];
ditto.
The other part is looking good to me.
Reviewed-by: Hajime Tazaki <thehajime at gmail.com>
-- Hajime
More information about the linux-um
mailing list