sched_fork: Use READ_ONCE() for lockless read of current->normal_prio
PATCH 1/1 sched_fork: Use READ_ONCE() for lockless read of current->normal_prio
The current->normal_prio is locklessly accessed from sched_fork and child's scheduler related initialization procedures heavily rely on the value loaded. Thus we mark this load as READ_ONCE in case of possible load tearing due to concurrent access from other paths, for example if changes of parent's normal_prio happens to be requested via some syscall.
Signed-off-by Ze Gao <[email protected]>
--- kernel/sched/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
@@ -4699,7 +4699,7 @@ int sched_fork(unsigned long clone_flags, struct task_struct *p)/* * Make sure we do not leak PI boosting priority to the child. */ - p->prio = current->normal_prio; + p->prio =READ_ONCE (current->normal_prio);uclamp_fork (p);
Signature · 1 line
2.40.1