Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched: add READ_ONCE to task_on_rq_queued

task_on_rq_queued read p->on_rq without READ_ONCE, though p->on_rq is
set with WRITE_ONCE in {activate|deactivate}_task and smp_store_release
in __block_task, and also read with READ_ONCE in task_on_rq_migrating.

Make all of these accesses pair together by adding READ_ONCE in the
task_on_rq_queued.

Signed-off-by: Harshit Agarwal <harshit@nutanix.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Phil Auld <pauld@redhat.com>
Link: https://lkml.kernel.org/r/20241114210812.1836587-1-jon@nutanix.com

authored by

Harshit Agarwal and committed by
Peter Zijlstra
59297e20 108ad099

+1 -1
+1 -1
kernel/sched/sched.h
··· 2271 2271 2272 2272 static inline int task_on_rq_queued(struct task_struct *p) 2273 2273 { 2274 - return p->on_rq == TASK_ON_RQ_QUEUED; 2274 + return READ_ONCE(p->on_rq) == TASK_ON_RQ_QUEUED; 2275 2275 } 2276 2276 2277 2277 static inline int task_on_rq_migrating(struct task_struct *p)