Closed ShirleyFei closed 1 year ago
In my understanding, threads in state 'I' are still uninterruptible threads from which the sleep state can not be interrupted by a received signal and therefore it is correct that they are counted as they currently are. The fact that they won't contribute to the load average values doesn't make them interruptible. By reverting the patch, idle threads are not counted at all any more.
Closed by introducing separate counter.
According to task_state_array[] from Linux kernel, "D (disk sleep)" is reported for TASK_UNINTERRUPTIBLE, and "I (idle)" is reported for TASK_IDLE[1], which composes by (TASK_UNINTERRUPTIBLE | TASK_NOLOAD). The special flag TASK_NOLOAD[2] is added for calculating idle kernel threads which do not contribute to load average like uninterruptible processes do.
Thus only TASK_UNINTERRUPTIBLE("D") is needed. Rectify this by reverting the previous patch: "Count idle threads as non-interruptible threads" as https://github.com/Atoptool/atop/commit/bb38fd80633cf11475fc18191d4cc8bf3f0e67ba
[1]https://yhbt.net/lore/all/20170925121117.224552932@infradead.org/1-peterz-sched-state-6.patch [2]https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=80ed87c8a9ca0cad7ca66cf3bbdfb17559a66dcf