Skip to content

Commit 0d6b352

Browse files
neilbrownIngo Molnar
authored andcommitted
sched/core: Report correct state for TASK_IDLE | TASK_FREEZABLE
task_state_index() ignores uninteresting state flags (such as TASK_FREEZABLE) for most states, but for TASK_IDLE and TASK_RTLOCK_WAIT it does not. So if a task is waiting TASK_IDLE|TASK_FREEZABLE it gets incorrectly reported as TASK_UNINTERRUPTIBLE or "D". (it is planned for nfsd to change to use this state). Fix this by only testing the interesting bits and not the irrelevant bits in __task_state_index() Signed-off-by: NeilBrown <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c958ca2 commit 0d6b352

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/sched.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1671,15 +1671,15 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
16711671

16721672
BUILD_BUG_ON_NOT_POWER_OF_2(TASK_REPORT_MAX);
16731673

1674-
if (tsk_state == TASK_IDLE)
1674+
if ((tsk_state & TASK_IDLE) == TASK_IDLE)
16751675
state = TASK_REPORT_IDLE;
16761676

16771677
/*
16781678
* We're lying here, but rather than expose a completely new task state
16791679
* to userspace, we can make this appear as if the task has gone through
16801680
* a regular rt_mutex_lock() call.
16811681
*/
1682-
if (tsk_state == TASK_RTLOCK_WAIT)
1682+
if (tsk_state & TASK_RTLOCK_WAIT)
16831683
state = TASK_UNINTERRUPTIBLE;
16841684

16851685
return fls(state);

0 commit comments

Comments
 (0)