我认为iowait / irq / softirq不在前4个数字之一中。您可以在内核代码中看到irqtime_account_process_tick的注释,以获取更多详细信息:
(对于Linux内核4.1.1)
2815 * Tick demultiplexing follows the order
2816 * - pending hardirq update <-- this is irq
2817 * - pending softirq update <-- this is softirq
2818 * - user_time
2819 * - idle_time <-- iowait is included in here, discuss below
2820 * - system time
2821 * - check for guest_time
2822 * - else account as system_time
有关空闲时间的处理,请参见account_idle_time函数:
2772 /*
2773 * Account for idle time.
2774 * @cputime: the cpu time spent in idle wait
2775 */
2776 void account_idle_time(cputime_t cputime)
2777 {
2778 u64 *cpustat = kcpustat_this_cpu->cpustat;
2779 struct rq *rq = this_rq();
2780
2781 if (atomic_read(&rq->nr_iowait) > 0)
2782 cpustat[cpuTIME_IOWAIT] += (__force u64) cputime;
2783 else
2784 cpustat[cpuTIME_IDLE] += (__force u64) cputime;
2785 }
如果cpu空闲并且有一些IO待处理,它将在cpuTIME_IOWAIT中计算时间。否则,它计入cpuTIME_IDLE中。
总而言之,我认为irq / softirq中的烦恼对于cpu而言应视为“忙”,因为它实际上正在处理某些IRQ或软IRQ。另一方面,对于cpu,“ iowait”中的烦恼应视为“空闲”,因为它没有做任何事情,而是在等待未决的IO发生。