forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm…
…/linux/kernel/git/tip/tip Pull scheduler fix from Thomas Gleixner: "Fix a long standing state race in finish_task_switch()" * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/core: Fix TASK_DEAD race in finish_task_switch()
- Loading branch information
Showing
2 changed files
with
8 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2517,11 +2517,11 @@ static struct rq *finish_task_switch(struct task_struct *prev) | |
* If a task dies, then it sets TASK_DEAD in tsk->state and calls | ||
* schedule one last time. The schedule call will never return, and | ||
* the scheduled task must drop that reference. | ||
* The test for TASK_DEAD must occur while the runqueue locks are | ||
* still held, otherwise prev could be scheduled on another cpu, die | ||
* there before we look at prev->state, and then the reference would | ||
* be dropped twice. | ||
* Manfred Spraul <[email protected]> | ||
* | ||
* We must observe prev->state before clearing prev->on_cpu (in | ||
* finish_lock_switch), otherwise a concurrent wakeup can get prev | ||
* running on another CPU and we could rave with its RUNNING -> DEAD | ||
* transition, resulting in a double drop. | ||
*/ | ||
prev_state = prev->state; | ||
vtime_task_switch(prev); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters