[Devel] [PATCH vz10 03/14] sched: fix this_rq_raw() definition for !SMP builds

Eva Kurchatova eva.kurchatova at virtuozzo.com
Fri Jun 26 01:08:05 MSK 2026


On !SMP builds, the this_rq_raw() macro used PERCPU_PTR() which is no
longer defined. Since percpu pointers are plain pointers on !SMP, cast
through (void *) to strip the __percpu annotation without requiring
the complete struct rq type to be visible.

Update the comment to reflect the actual implementation.

Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
 include/linux/sched.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 10545e470d3d..ea3bc4a5c831 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2348,12 +2348,14 @@ DECLARE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues);
  * this_cpu_ptr() -> raw_cpu_ptr() -> __verify_pcpu_ptr():
  *   typeof((ptr) + 0)
  *
- * So use arch_raw_cpu_ptr()/PERCPU_PTR() directly here.
+ * So use arch_raw_cpu_ptr() directly here.
+ * On !SMP percpu pointers are plain pointers; cast through (void *)
+ * to strip __percpu without needing the complete struct rq type.
  */
 #ifdef CONFIG_SMP
 #define this_rq_raw() arch_raw_cpu_ptr(&runqueues)
 #else
-#define this_rq_raw() PERCPU_PTR(&runqueues)
+#define this_rq_raw() ((void __kernel __force *)&(runqueues))
 #endif
 #define this_rq_pinned() (*(unsigned int *)((void *)this_rq_raw() + RQ_nr_pinned))
 
-- 
2.54.0



More information about the Devel mailing list