Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\apm_32.c Create Date:2022-07-28 08:22:13
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:apm_cpu_idle

Proto:static int apm_cpu_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index)

Type:int

Parameter:

TypeParameterName
struct cpuidle_device *dev
struct cpuidle_driver *drv
intindex
908  apm_idle_done = 0
909  jiffies_since_last_check = jiffies - last_jiffies
912  recalc :
913  task_cputime(current process, & utime, & stime)
914  If jiffies_since_last_check > If no process has really been interested in* the CPU for some time, we want to call BIOS* power management - we probably want* to conserve power. Then
915  use_apm_idle = 0
916  Else if jiffies_since_last_check > idle_period Then
919  idle_percentage = nsecs_to_jiffies(stime - last_stime)
920  idle_percentage *= 100
921  idle_percentage /= jiffies_since_last_check
922  use_apm_idle = idle_percentage > idle_threshold
923  If forbid_idle Then use_apm_idle = 0
927  last_jiffies = jiffies
928  last_stime = stime
930  bucket = IDLE_LEAKY_MAX
932  When Not need_resched() cycle
933  If use_apm_idle Then
936  t = jiffies
939  apm_idle_done = 1
940  If t != jiffies Then
941  If bucket Then
943  Continue
945  Else if bucket Then
946  bucket--
947  Continue
949  Break
951  apm_idle_done = 1
952  Break
953  Default
954  Break
957  We use this if we don't have any better idle routine..
958  local_irq_disable()
959  jiffies_since_last_check = jiffies - last_jiffies
960  If jiffies_since_last_check > idle_period Then Go to recalc
964  If apm_idle_done Then apm_do_busy - inform the BIOS the CPU is busy* Request that the BIOS brings the CPU back to full performance.
967  Return index