Skip to contentSkip to conversation

sched/core: aplly TASK_RUNNING in state judgement

PATCH New Liu Peibao 1 participant 1 message Nov 23, 2021 Scheduler

lore
Share & tools
lore

Liu Peibao

author
#0 lore raw

PATCH 1/1 sched/core: aplly TASK_RUNNING in state judgement

Looks more clearly.

---
 kernel/sched/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/core.c +1 -1
index 3c9b0fd..abafd2e 100644
@@ -6181,7 +6181,7 @@ static void __sched notrace __schedule(unsigned int sched_mode)
 	 *  - ptrace_{,un}freeze_traced() can change ->state underneath us.
 	 */
 	prev_state = READ_ONCE(prev->__state);
-	if (!(sched_mode & SM_MASK_PREEMPT) && prev_state) {
+	if (!(sched_mode & SM_MASK_PREEMPT) && (prev_state != TASK_RUNNING)) {
 		if (signal_pending_state(prev_state, prev)) {
 			WRITE_ONCE(prev->__state, TASK_RUNNING);
 		} else {
Signature · 1 line
1.8.3.1