[PATCH 0/2] sched: Fix a race between CPU onlining & user task scheduling

From: Paul Burton
Date: Sat May 26 2018 - 11:47:34 EST


This short series fixes a race condition I've observed in which user
tasks can be scheduled on CPUs that are still in the process of being
brought online (or rather being made active) by hotplug.

I've created a small test case for the observed problem here:

https://gist.github.com/paulburton/25187c4f537263a6be9c8aac67bd33bf

The issue was first observed on a MIPS system running a test program
that was sensitive to CPU affinity, but has been reproduced on x86_64
using the above program too. On my laptop with an Intel i7-5600U CPU the
test tends to fail within 10 minutes, but with this series applied runs
cleanly overnight.

Thanks,
Paul

Paul Burton (2):
sched: Make select_task_rq() require cpu_active() for user tasks
sched: Warn if we fail to migrate a task

kernel/sched/core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

--
2.17.0