diff options
author | Harshit Agarwal <harshit@nutanix.com> | 2025-04-08 04:50:21 +0000 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2025-09-03 10:03:12 +0200 |
commit | 8fd5485fb4f3d9da3977fd783fcb8e5452463420 (patch) | |
tree | 2327a9d2ade68f0a00cc19d0b47e83e8dcb5f428 /rust/helpers/task.c | |
parent | b320789d6883cc00ac78ce83bccbfe7ed58afcf0 (diff) |
sched/deadline: Fix race in push_dl_task()
When a CPU chooses to call push_dl_task and picks a task to push to
another CPU's runqueue then it will call find_lock_later_rq method
which would take a double lock on both CPUs' runqueues. If one of the
locks aren't readily available, it may lead to dropping the current
runqueue lock and reacquiring both the locks at once. During this window
it is possible that the task is already migrated and is running on some
other CPU. These cases are already handled. However, if the task is
migrated and has already been executed and another CPU is now trying to
wake it up (ttwu) such that it is queued again on the runqeue
(on_rq is 1) and also if the task was run by the same CPU, then the
current checks will pass even though the task was migrated out and is no
longer in the pushable tasks list.
Please go through the original rt change for more details on the issue.
To fix this, after the lock is obtained inside the find_lock_later_rq,
it ensures that the task is still at the head of pushable tasks list.
Also removed some checks that are no longer needed with the addition of
this new check.
However, the new check of pushable tasks list only applies when
find_lock_later_rq is called by push_dl_task. For the other caller i.e.
dl_task_offline_migration, existing checks are used.
Signed-off-by: Harshit Agarwal <harshit@nutanix.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20250408045021.3283624-1-harshit@nutanix.com
Diffstat (limited to 'rust/helpers/task.c')
0 files changed, 0 insertions, 0 deletions