Function report |
Source Code:kernel\power\process.c |
Create Date:2022-07-28 09:57:39 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:try_to_freeze_tasks
Proto:static int try_to_freeze_tasks(bool user_only)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
bool | user_only |
36 | bool wq_busy = false |
39 | bool wakeup = false |
40 | sleep_usecs = USEC_PER_MSEC |
42 | start = ktime_get_boottime - Returns monotonic time since boot in ktime_t format* This is similar to CLOCK_MONTONIC/ktime_get, but also includes the* time spent in suspend. |
46 | If Not user_only Then freeze_workqueues_begin() |
49 | When (true) cycle |
50 | todo = 0 |
51 | read_lock( & tasklist_lock) |
56 | If Not freezer_should_skip(p) Then todo++ |
59 | read_unlock( & tasklist_lock) |
61 | If Not user_only Then |
62 | wq_busy = freeze_workqueues_busy() |
69 | If pm_wakeup_pending() Then |
70 | wakeup = true |
71 | Break |
79 | usleep_range(sleep_usecs / 2, sleep_usecs) |
80 | If sleep_usecs < 8 * USEC_PER_MSEC Then sleep_usecs *= 2 |
84 | end = ktime_get_boottime - Returns monotonic time since boot in ktime_t format* This is similar to CLOCK_MONTONIC/ktime_get, but also includes the* time spent in suspend. |
86 | elapsed_msecs = ktime_to_ms(elapsed) |
88 | If todo Then |
90 | pr_err("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 | If wq_busy Then show_workqueue_state - dump workqueue state* Called from a sysrq handler or try_to_freeze_tasks() and prints out* all busy workqueues and pools. |
99 | If Not wakeup || pm_debug_messages_on Then |
100 | read_lock( & tasklist_lock) |
102 | If p != current process && Not freezer_should_skip(p) && freezing(p) && Not frozen(p) Then sched_show_task(p) |
106 | read_unlock( & tasklist_lock) |
108 | Else |
109 | Like KERN_CONT, pr_cont() should only be used when continuing* a line with no newline ('\n') enclosed. Otherwise it defaults* back to KERN_DEFAULT.("(elapsed %d.%03d seconds) ", elapsed_msecs / 1000, elapsed_msecs % 1000) |
Name | Describe |
---|---|
freeze_processes | ze_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_threads | ze_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 |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |