[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <169338315320.27769.8110818359397808973.tip-bot2@tip-bot2>
Date: Wed, 30 Aug 2023 08:12:33 -0000
From: "tip-bot2 for NeilBrown" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: NeilBrown <neilb@...e.de>, Ingo Molnar <mingo@...nel.org>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/urgent] sched/core: Report correct state for TASK_IDLE |
TASK_FREEZABLE
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: 0d6b35283bcf1a379cf20066544af8e6a6b16b46
Gitweb: https://git.kernel.org/tip/0d6b35283bcf1a379cf20066544af8e6a6b16b46
Author: NeilBrown <neilb@...e.de>
AuthorDate: Wed, 30 Aug 2023 09:04:19 +10:00
Committer: Ingo Molnar <mingo@...nel.org>
CommitterDate: Wed, 30 Aug 2023 10:08:38 +02:00
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 <neilb@...e.de>
Signed-off-by: Ingo Molnar <mingo@...nel.org>
Link: https://lore.kernel.org/r/169335025927.5133.4781141800413736103@noble.neil.brown.name
---
include/linux/sched.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index ae6fd76..77f01ac 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1671,7 +1671,7 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
BUILD_BUG_ON_NOT_POWER_OF_2(TASK_REPORT_MAX);
- if (tsk_state == TASK_IDLE)
+ if ((tsk_state & TASK_IDLE) == TASK_IDLE)
state = TASK_REPORT_IDLE;
/*
@@ -1679,7 +1679,7 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
* to userspace, we can make this appear as if the task has gone through
* a regular rt_mutex_lock() call.
*/
- if (tsk_state == TASK_RTLOCK_WAIT)
+ if (tsk_state & TASK_RTLOCK_WAIT)
state = TASK_UNINTERRUPTIBLE;
return fls(state);
Powered by blists - more mailing lists