64 lines
1.7 KiB
Diff
64 lines
1.7 KiB
Diff
|
From 2c96c2eabfe092f7b1ada3827737009ee84cb60f Mon Sep 17 00:00:00 2001
|
||
|
From: Jake Day <jake@ninebysix.com>
|
||
|
Date: Sun, 27 Jan 2019 10:45:42 -0500
|
||
|
Subject: [PATCH 02/11] resume-delay
|
||
|
|
||
|
---
|
||
|
kernel/power/suspend.c | 11 +++++++++++
|
||
|
kernel/sysctl.c | 9 +++++++++
|
||
|
2 files changed, 20 insertions(+)
|
||
|
|
||
|
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
|
||
|
index 0bd595a0b610..a8385e8894a5 100644
|
||
|
--- a/kernel/power/suspend.c
|
||
|
+++ b/kernel/power/suspend.c
|
||
|
@@ -526,6 +526,8 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||
|
goto Resume_devices;
|
||
|
}
|
||
|
|
||
|
+unsigned int resume_delay = 3000;
|
||
|
+
|
||
|
/**
|
||
|
* suspend_finish - Clean up before finishing the suspend sequence.
|
||
|
*
|
||
|
@@ -534,6 +536,15 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||
|
*/
|
||
|
static void suspend_finish(void)
|
||
|
{
|
||
|
+ if (resume_delay) {
|
||
|
+ /* Give kernel threads a head start, such that usb-storage
|
||
|
+ * can detect devices before syslog attempts to write log
|
||
|
+ * messages from the suspend code.
|
||
|
+ */
|
||
|
+ thaw_kernel_threads();
|
||
|
+ pr_debug("PM: Sleeping for %d milliseconds.\n", resume_delay);
|
||
|
+ msleep(resume_delay);
|
||
|
+ }
|
||
|
suspend_thaw_processes();
|
||
|
pm_notifier_call_chain(PM_POST_SUSPEND);
|
||
|
pm_restore_console();
|
||
|
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
||
|
index cc02050fd0c4..11802bda1a5d 100644
|
||
|
--- a/kernel/sysctl.c
|
||
|
+++ b/kernel/sysctl.c
|
||
|
@@ -311,7 +311,16 @@ static int min_extfrag_threshold;
|
||
|
static int max_extfrag_threshold = 1000;
|
||
|
#endif
|
||
|
|
||
|
+extern unsigned int resume_delay;
|
||
|
+
|
||
|
static struct ctl_table kern_table[] = {
|
||
|
+ {
|
||
|
+ .procname = "resume_delay",
|
||
|
+ .data = &resume_delay,
|
||
|
+ .maxlen = sizeof(unsigned int),
|
||
|
+ .mode = 0644,
|
||
|
+ .proc_handler = proc_dointvec,
|
||
|
+ },
|
||
|
{
|
||
|
.procname = "sched_child_runs_first",
|
||
|
.data = &sysctl_sched_child_runs_first,
|
||
|
--
|
||
|
2.17.1
|
||
|
|