[External] Re: [PATCH v8 3/3] riscv: store percpu offset into thread_info
yunhui cui
cuiyunhui at bytedance.com
Sun Nov 8 00:27:42 PST 2026
Hi Thomas,
On Sat, Jul 4, 2026 at 5:02 AM Thomas Gleixner <tglx at kernel.org> wrote:
>
> 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?
>
Agreed. current is __prev at this point, and both forms compile to the
same load/store sequence. Passing __prev explicitly is clearer, so I will
copy its pcpu_offset directly to __next.
Thanks,
Yunhui
More information about the linux-riscv
mailing list