diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/power/hibernate.c | 5 | ||||
-rw-r--r-- | kernel/power/main.c | 14 | ||||
-rw-r--r-- | kernel/power/suspend.c | 13 | ||||
-rw-r--r-- | kernel/power/user.c | 5 | ||||
-rw-r--r-- | kernel/sched/cpufreq_schedutil.c | 21 | ||||
-rw-r--r-- | kernel/time/tick-sched.c | 12 |
6 files changed, 43 insertions, 27 deletions
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c index cfc7a57049e4..c8c272df7154 100644 --- a/kernel/power/hibernate.c +++ b/kernel/power/hibernate.c | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/export.h> | 15 | #include <linux/export.h> |
16 | #include <linux/suspend.h> | 16 | #include <linux/suspend.h> |
17 | #include <linux/syscalls.h> | ||
18 | #include <linux/reboot.h> | 17 | #include <linux/reboot.h> |
19 | #include <linux/string.h> | 18 | #include <linux/string.h> |
20 | #include <linux/device.h> | 19 | #include <linux/device.h> |
@@ -709,9 +708,7 @@ int hibernate(void) | |||
709 | goto Exit; | 708 | goto Exit; |
710 | } | 709 | } |
711 | 710 | ||
712 | pr_info("Syncing filesystems ... \n"); | 711 | ksys_sync_helper(); |
713 | ksys_sync(); | ||
714 | pr_info("done.\n"); | ||
715 | 712 | ||
716 | error = freeze_processes(); | 713 | error = freeze_processes(); |
717 | if (error) | 714 | if (error) |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 98e76cad128b..4f43e724f6eb 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/debugfs.h> | 16 | #include <linux/debugfs.h> |
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | #include <linux/suspend.h> | 18 | #include <linux/suspend.h> |
19 | #include <linux/syscalls.h> | ||
19 | 20 | ||
20 | #include "power.h" | 21 | #include "power.h" |
21 | 22 | ||
@@ -51,6 +52,19 @@ void unlock_system_sleep(void) | |||
51 | } | 52 | } |
52 | EXPORT_SYMBOL_GPL(unlock_system_sleep); | 53 | EXPORT_SYMBOL_GPL(unlock_system_sleep); |
53 | 54 | ||
55 | void ksys_sync_helper(void) | ||
56 | { | ||
57 | ktime_t start; | ||
58 | long elapsed_msecs; | ||
59 | |||
60 | start = ktime_get(); | ||
61 | ksys_sync(); | ||
62 | elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start)); | ||
63 | pr_info("Filesystems sync: %ld.%03ld seconds\n", | ||
64 | elapsed_msecs / MSEC_PER_SEC, elapsed_msecs % MSEC_PER_SEC); | ||
65 | } | ||
66 | EXPORT_SYMBOL_GPL(ksys_sync_helper); | ||
67 | |||
54 | /* Routines for PM-transition notifications */ | 68 | /* Routines for PM-transition notifications */ |
55 | 69 | ||
56 | static BLOCKING_NOTIFIER_HEAD(pm_chain_head); | 70 | static BLOCKING_NOTIFIER_HEAD(pm_chain_head); |
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 59b6def23046..ef908c134b34 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/console.h> | 17 | #include <linux/console.h> |
18 | #include <linux/cpu.h> | 18 | #include <linux/cpu.h> |
19 | #include <linux/cpuidle.h> | 19 | #include <linux/cpuidle.h> |
20 | #include <linux/syscalls.h> | ||
21 | #include <linux/gfp.h> | 20 | #include <linux/gfp.h> |
22 | #include <linux/io.h> | 21 | #include <linux/io.h> |
23 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
@@ -568,13 +567,11 @@ static int enter_state(suspend_state_t state) | |||
568 | if (state == PM_SUSPEND_TO_IDLE) | 567 | if (state == PM_SUSPEND_TO_IDLE) |
569 | s2idle_begin(); | 568 | s2idle_begin(); |
570 | 569 | ||
571 | #ifndef CONFIG_SUSPEND_SKIP_SYNC | 570 | if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC)) { |
572 | trace_suspend_resume(TPS("sync_filesystems"), 0, true); | 571 | trace_suspend_resume(TPS("sync_filesystems"), 0, true); |
573 | pr_info("Syncing filesystems ... "); | 572 | ksys_sync_helper(); |
574 | ksys_sync(); | 573 | trace_suspend_resume(TPS("sync_filesystems"), 0, false); |
575 | pr_cont("done.\n"); | 574 | } |
576 | trace_suspend_resume(TPS("sync_filesystems"), 0, false); | ||
577 | #endif | ||
578 | 575 | ||
579 | pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]); | 576 | pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]); |
580 | pm_suspend_clear_flags(); | 577 | pm_suspend_clear_flags(); |
diff --git a/kernel/power/user.c b/kernel/power/user.c index 2d8b60a3c86b..cb24e840a3e6 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/suspend.h> | 12 | #include <linux/suspend.h> |
13 | #include <linux/syscalls.h> | ||
14 | #include <linux/reboot.h> | 13 | #include <linux/reboot.h> |
15 | #include <linux/string.h> | 14 | #include <linux/string.h> |
16 | #include <linux/device.h> | 15 | #include <linux/device.h> |
@@ -228,9 +227,7 @@ static long snapshot_ioctl(struct file *filp, unsigned int cmd, | |||
228 | if (data->frozen) | 227 | if (data->frozen) |
229 | break; | 228 | break; |
230 | 229 | ||
231 | printk("Syncing filesystems ... "); | 230 | ksys_sync_helper(); |
232 | ksys_sync(); | ||
233 | printk("done.\n"); | ||
234 | 231 | ||
235 | error = freeze_processes(); | 232 | error = freeze_processes(); |
236 | if (error) | 233 | if (error) |
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 3638d2377e3c..5403479073b0 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c | |||
@@ -13,6 +13,8 @@ | |||
13 | #include <linux/sched/cpufreq.h> | 13 | #include <linux/sched/cpufreq.h> |
14 | #include <trace/events/power.h> | 14 | #include <trace/events/power.h> |
15 | 15 | ||
16 | #define IOWAIT_BOOST_MIN (SCHED_CAPACITY_SCALE / 8) | ||
17 | |||
16 | struct sugov_tunables { | 18 | struct sugov_tunables { |
17 | struct gov_attr_set attr_set; | 19 | struct gov_attr_set attr_set; |
18 | unsigned int rate_limit_us; | 20 | unsigned int rate_limit_us; |
@@ -51,7 +53,6 @@ struct sugov_cpu { | |||
51 | u64 last_update; | 53 | u64 last_update; |
52 | 54 | ||
53 | unsigned long bw_dl; | 55 | unsigned long bw_dl; |
54 | unsigned long min; | ||
55 | unsigned long max; | 56 | unsigned long max; |
56 | 57 | ||
57 | /* The field below is for single-CPU policies only: */ | 58 | /* The field below is for single-CPU policies only: */ |
@@ -291,8 +292,8 @@ static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu) | |||
291 | * | 292 | * |
292 | * The IO wait boost of a task is disabled after a tick since the last update | 293 | * The IO wait boost of a task is disabled after a tick since the last update |
293 | * of a CPU. If a new IO wait boost is requested after more then a tick, then | 294 | * of a CPU. If a new IO wait boost is requested after more then a tick, then |
294 | * we enable the boost starting from the minimum frequency, which improves | 295 | * we enable the boost starting from IOWAIT_BOOST_MIN, which improves energy |
295 | * energy efficiency by ignoring sporadic wakeups from IO. | 296 | * efficiency by ignoring sporadic wakeups from IO. |
296 | */ | 297 | */ |
297 | static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, | 298 | static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, |
298 | bool set_iowait_boost) | 299 | bool set_iowait_boost) |
@@ -303,7 +304,7 @@ static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, | |||
303 | if (delta_ns <= TICK_NSEC) | 304 | if (delta_ns <= TICK_NSEC) |
304 | return false; | 305 | return false; |
305 | 306 | ||
306 | sg_cpu->iowait_boost = set_iowait_boost ? sg_cpu->min : 0; | 307 | sg_cpu->iowait_boost = set_iowait_boost ? IOWAIT_BOOST_MIN : 0; |
307 | sg_cpu->iowait_boost_pending = set_iowait_boost; | 308 | sg_cpu->iowait_boost_pending = set_iowait_boost; |
308 | 309 | ||
309 | return true; | 310 | return true; |
@@ -317,8 +318,9 @@ static bool sugov_iowait_reset(struct sugov_cpu *sg_cpu, u64 time, | |||
317 | * | 318 | * |
318 | * Each time a task wakes up after an IO operation, the CPU utilization can be | 319 | * Each time a task wakes up after an IO operation, the CPU utilization can be |
319 | * boosted to a certain utilization which doubles at each "frequent and | 320 | * boosted to a certain utilization which doubles at each "frequent and |
320 | * successive" wakeup from IO, ranging from the utilization of the minimum | 321 | * successive" wakeup from IO, ranging from IOWAIT_BOOST_MIN to the utilization |
321 | * OPP to the utilization of the maximum OPP. | 322 | * of the maximum OPP. |
323 | * | ||
322 | * To keep doubling, an IO boost has to be requested at least once per tick, | 324 | * To keep doubling, an IO boost has to be requested at least once per tick, |
323 | * otherwise we restart from the utilization of the minimum OPP. | 325 | * otherwise we restart from the utilization of the minimum OPP. |
324 | */ | 326 | */ |
@@ -349,7 +351,7 @@ static void sugov_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, | |||
349 | } | 351 | } |
350 | 352 | ||
351 | /* First wakeup after IO: start with minimum boost */ | 353 | /* First wakeup after IO: start with minimum boost */ |
352 | sg_cpu->iowait_boost = sg_cpu->min; | 354 | sg_cpu->iowait_boost = IOWAIT_BOOST_MIN; |
353 | } | 355 | } |
354 | 356 | ||
355 | /** | 357 | /** |
@@ -389,7 +391,7 @@ static unsigned long sugov_iowait_apply(struct sugov_cpu *sg_cpu, u64 time, | |||
389 | * No boost pending; reduce the boost value. | 391 | * No boost pending; reduce the boost value. |
390 | */ | 392 | */ |
391 | sg_cpu->iowait_boost >>= 1; | 393 | sg_cpu->iowait_boost >>= 1; |
392 | if (sg_cpu->iowait_boost < sg_cpu->min) { | 394 | if (sg_cpu->iowait_boost < IOWAIT_BOOST_MIN) { |
393 | sg_cpu->iowait_boost = 0; | 395 | sg_cpu->iowait_boost = 0; |
394 | return util; | 396 | return util; |
395 | } | 397 | } |
@@ -827,9 +829,6 @@ static int sugov_start(struct cpufreq_policy *policy) | |||
827 | memset(sg_cpu, 0, sizeof(*sg_cpu)); | 829 | memset(sg_cpu, 0, sizeof(*sg_cpu)); |
828 | sg_cpu->cpu = cpu; | 830 | sg_cpu->cpu = cpu; |
829 | sg_cpu->sg_policy = sg_policy; | 831 | sg_cpu->sg_policy = sg_policy; |
830 | sg_cpu->min = | ||
831 | (SCHED_CAPACITY_SCALE * policy->cpuinfo.min_freq) / | ||
832 | policy->cpuinfo.max_freq; | ||
833 | } | 832 | } |
834 | 833 | ||
835 | for_each_cpu(cpu, policy->cpus) { | 834 | for_each_cpu(cpu, policy->cpus) { |
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index bdf00c763ee3..f4ee1a3428ae 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c | |||
@@ -1038,6 +1038,18 @@ bool tick_nohz_idle_got_tick(void) | |||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | /** | 1040 | /** |
1041 | * tick_nohz_get_next_hrtimer - return the next expiration time for the hrtimer | ||
1042 | * or the tick, whatever that expires first. Note that, if the tick has been | ||
1043 | * stopped, it returns the next hrtimer. | ||
1044 | * | ||
1045 | * Called from power state control code with interrupts disabled | ||
1046 | */ | ||
1047 | ktime_t tick_nohz_get_next_hrtimer(void) | ||
1048 | { | ||
1049 | return __this_cpu_read(tick_cpu_device.evtdev)->next_event; | ||
1050 | } | ||
1051 | |||
1052 | /** | ||
1041 | * tick_nohz_get_sleep_length - return the expected length of the current sleep | 1053 | * tick_nohz_get_sleep_length - return the expected length of the current sleep |
1042 | * @delta_next: duration until the next event if the tick cannot be stopped | 1054 | * @delta_next: duration until the next event if the tick cannot be stopped |
1043 | * | 1055 | * |