On Tue, Aug 19, 2025 at 09:58:31AM +0800, Menglong Dong wrote: > The "struct rq" is not available in include/linux/sched.h, so we can't > access the "runqueues" with this_cpu_ptr(), as the compilation will fail > in this_cpu_ptr() -> raw_cpu_ptr() -> __verify_pcpu_ptr(): > typeof((ptr) + 0) > > So we introduce the this_rq_raw() and access the runqueues with > arch_raw_cpu_ptr() directly. ^ That, wants to be a comment near here: > @@ -2312,4 +2315,78 @@ static __always_inline void alloc_tag_restore(struct alloc_tag *tag, struct allo > #define alloc_tag_restore(_tag, _old) do {} while (0) > #endif > > +#ifndef COMPILE_OFFSETS > + > +extern void __migrate_enable(void); > + > +struct rq; > +DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); > + > +#ifdef CONFIG_SMP > +#define this_rq_raw() arch_raw_cpu_ptr(&runqueues) > +#else > +#define this_rq_raw() PERCPU_PTR(&runqueues) > +#endif Because that arch_ thing really is weird. > + (*(unsigned int *)((void *)this_rq_raw() + RQ_nr_pinned))--; > + (*(unsigned int *)((void *)this_rq_raw() + RQ_nr_pinned))++; And since you did a macro anyway, why not fold that magic in there, instead of duplicating it? #define __this_rq_raw() ((void *)arch_raw_cpu_ptr(&runqueues)) #define this_rq_pinned() (*(unsigned int *)(__this_rq_raw() + RQ_nr_pinned)) this_rq_pinned()--; this_rq_pinned()++; is nicer, no?