[知其然不知其所以然-29] Keep system as idle as possible

来源:互联网 发布:mysql持久化是什么 编辑:程序博客网 时间:2024/05/16 07:49

Previously someone reported to me that, his system can not stay in low power state for long time,

thus woken up from S0ix.

According to  reporter, most of the wake up which break S0ix on his platform
are triggered by timer interrupt, and based on the output
of /proc/timer_list, the most active timers are illustrated below as:

tick_sched_timer
watchdog_timer_fn
several other hrtimer_wakeup by applications

So here's my ponit of  view on reducing such timer interrupts:

1. tick_sched_timer
    Although the system is config with CONFIG_NOHZ,
which means if the CPU is in idle then there would be no
tick triggered. But a more complete solution is always set
CONFIG_NO_HZ_FULL, which means that, besides cpu idle,
if there is only one task running on the CPU, there would be
no tick triggered, thus trigger defered softirqd/kevend, thus make

the cpu less likely to be in idle, so better set CONFIG_NO_HZ_FULL and
CONFIG_NO_HZ_FULL_ALL=y


2.watchdog_timer_fn
This one is to track whether there is deadlock on single CPU,
but in our case I don't think we need to enable softlockup/nmi detector
so better disable this watchdog by:
echo 0 > /proc/sys/kernel/watchdog_thresh

3.hrtimer_wakeup
This one is usually set up by user mode applications, such as
nanosleep, select, etc, according to OH's log,
we might need to kill or stop the following services:
avahi-daemon, tcf-agent, rpcbind,connmand
But a more straightfoward way is to boot with a mininmal
system, and see what's the status, for example, how about booting up
with init=/bin/bash?

0 0