aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorStefan Guendhoer <stefan@guendhoer.com>2016-01-07 22:23:23 +0000
committerMoyster <oysterized@gmail.com>2016-08-26 20:20:31 +0200
commite68ce258c35d28b497cdb11e1e5e9949f660d1ed (patch)
tree3ce2bc9414c9a0a89f43751a4fecd25b7f47535f /kernel
parent70321f3dc4559805113d383559197560b8d4cefa (diff)
power: make sync on suspend optional
propagate from (CR). On embedded devices with built-in batteries, it is not so important to sync the file systems before suspend. The chance of losing power during suspend are no greater than they are when the system is awake. The sync operations can greatly increase suspend latency when the system has accrued many dirty pages and/or the target storage devices are not particularly fast. This commit adds a kernel config option to allow file system sync in the suspend path to be disabled. It is enabled by default.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/Kconfig5
-rw-r--r--kernel/power/suspend.c2
2 files changed, 7 insertions, 0 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index c7638ed4c..9f0468d66 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -604,3 +604,8 @@ config SUSPEND_TIME
Prints the time spent in suspend in the kernel log, and
keeps statistics on the time spent in suspend in
/sys/kernel/debug/suspend_time
+
+config PM_SYNC_BEFORE_SUSPEND
+ bool "Sync file systems before suspend"
+ depends on PM
+ default y
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index e39ebe80a..aab3d642b 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -401,6 +401,7 @@ int enter_state(suspend_state_t state)
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
+#ifdef CONFIG_PM_SYNC_BEFORE_SUSPEND
printk(KERN_INFO "PM: Syncing filesystems ... ");
#if MTK_SOLUTION
error = suspend_syssync_enqueue();
@@ -412,6 +413,7 @@ int enter_state(suspend_state_t state)
sys_sync();
#endif
printk("done.\n");
+#endif
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label);
error = suspend_prepare(state);