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

Thomas Gleixner tglx at kernel.org
Fri Jul 3 14:02:28 PDT 2026


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?




More information about the linux-riscv mailing list