Re: [PATCH v8 3/3] riscv: store percpu offset into thread_info

From: Thomas Gleixner

Date: Fri Jul 03 2026 - 17:03:05 EST


On Fri, Jul 03 2026 at 20:28, Yunhui Cui wrote:
> +
> extern struct task_struct *__switch_to(struct task_struct *,
> struct task_struct *);
>
> @@ -122,6 +129,7 @@ do { \
> if (switch_to_should_flush_icache(__next)) \
> local_flush_icache_all(); \
> __switch_to_envcfg(__next); \
> + __switch_to_pcpu_offset(__next); \

Why do you want to go through the indirection of current:

> +static inline void __switch_to_pcpu_offset(struct task_struct *next)
> +{
> +#ifdef CONFIG_SMP
> + next->thread_info.pcpu_offset = __my_cpu_offset;
> +#endif
> +}

instead of using __prev->.....offset, which is right there available?