Skip to content

Commit 59297e2

Browse files
Harshit AgarwalPeter Zijlstra
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Phil Auld <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 108ad09 commit 59297e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static inline int task_on_cpu(struct rq *rq, struct task_struct *p)
22712271

22722272
static inline int task_on_rq_queued(struct task_struct *p)
22732273
{
2274-
return p->on_rq == TASK_ON_RQ_QUEUED;
2274+
return READ_ONCE(p->on_rq) == TASK_ON_RQ_QUEUED;
22752275
}
22762276

22772277
static inline int task_on_rq_migrating(struct task_struct *p)

0 commit comments

Comments
 (0)