函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\power\process.c Create Date:2022-07-27 10:57:50
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:try_to_freeze_tasks

函数原型:static int try_to_freeze_tasks(bool user_only)

返回类型:int

参数:

类型参数名称
booluser_only
36  bool wq_busy = false
39  bool wakeup = false
40  sleep_usecs等于USEC_PER_MSEC
42  start等于取运行时间
44  end_time等于jiffiesmsecs_to_jiffies: - convert milliseconds to jiffies*@m: time in milliseconds* conversion is done as follows:* - negative values mean 'infinite timeout' (MAX_JIFFY_OFFSET)* - 'too large' values [that would result in larger than
46  如果非user_onlyfreeze_workqueues_begin()
49  当(true)循环
50  todo等于0
51  read_lock( & tasklist_lock)
56  如果非freezer_should_skip(p)则todo自加
59  read_unlock( & tasklist_lock)
61  如果非user_only
63  todo加等于wq_busy
66  如果非todoThese inlines deal with timer wrapping correctly. You are * strongly encouraged to use them* 1. Because people otherwise forget* 2. Because if the timer wrap changes in future you won't have to* alter your driver code.(jiffies, end_time)则退出
69  如果pm_wakeup_pending()则
70  wakeup = true
71  退出
79  usleep_range(sleep_usecs / 2, sleep_usecs)
80  如果sleep_usecs小于8乘USEC_PER_MSECsleep_usecs乘等于2
84  end等于取运行时间
85  elapsed等于Subtract two ktime_t variables. rem = lhs -rhs: (end, start)
86  elapsed_msecs等于ktime_to_ms(elapsed)
88  如果todo
89  打印标准信息("\n")
90  打印错误信息("Freezing of tasks %s after %d.%03d seconds (%d tasks refusing to freeze, wq_busy=%d):\n", wakeup ? "aborted" : "failed", elapsed_msecs / 1000, elapsed_msecs % 1000, todo - wq_busy, wq_busy)
96  如果wq_busyshow_workqueue_state - dump workqueue state* Called from a sysrq handler or try_to_freeze_tasks() and prints out* all busy workqueues and pools.
99  如果非wakeuppm_debug_messages_on
102  如果p不等于当前进程且非freezer_should_skip(p)且freezing(p)且非frozen(p)则sched_show_task(p)
108  否则
109  打印标准信息("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000, elapsed_msecs % 1000)
113  返回:如果todo则负EBUSY否则0
调用者
名称描述
freeze_processesze_processes - Signal user space processes to enter the refrigerator.* The current thread will not be frozen. The same process that calls* freeze_processes must later call thaw_processes.* On success, returns 0
freeze_kernel_threadsze_kernel_threads - Make freezable kernel threads go to the refrigerator.* On success, returns 0. On failure, -errno and only the kernel threads are* thawed, so as to give a chance to the caller to do additional cleanups