summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2015-07-31 12:46:17 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-07-31 17:46:05 -0400
commit2fd77fff4b440c29b48c31db0ce2aec7d319959f (patch)
treefe1c131b86a1cefe66e2ed2b7641b8c8db78c757 /kernel/power
parent019d8817b1b064c2bacfbcf40fc68184438ad05a (diff)
PM / suspend: make sync() on suspend-to-RAM build-time optional
The Linux kernel suspend path has traditionally invoked sys_sync() before freezing user threads. But sys_sync() can be expensive, and some user-space OS's do not want the kernel to pay the cost of sys_sync() on every suspend -- preferring invoke sync() from user-space if/when they want it. So make sys_sync on suspend build-time optional. The default is unchanged. Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/Kconfig10
-rw-r--r--kernel/power/suspend.c2
2 files changed, 12 insertions, 0 deletions
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index 9e302315e33d..02e8dfaa1ce2 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -18,6 +18,16 @@ config SUSPEND_FREEZER
18 18
19 Turning OFF this setting is NOT recommended! If in doubt, say Y. 19 Turning OFF this setting is NOT recommended! If in doubt, say Y.
20 20
21config SUSPEND_SKIP_SYNC
22 bool "Skip kernel's sys_sync() on suspend to RAM/standby"
23 depends on SUSPEND
24 depends on EXPERT
25 help
26 Skip the kernel sys_sync() before freezing user processes.
27 Some systems prefer not to pay this cost on every invocation
28 of suspend, or they are content with invoking sync() from
29 user-space before invoking suspend. Say Y if that's your case.
30
21config HIBERNATE_CALLBACKS 31config HIBERNATE_CALLBACKS
22 bool 32 bool
23 33
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 53266b729fd9..7e4cda4a8dd9 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -484,11 +484,13 @@ static int enter_state(suspend_state_t state)
484 if (state == PM_SUSPEND_FREEZE) 484 if (state == PM_SUSPEND_FREEZE)
485 freeze_begin(); 485 freeze_begin();
486 486
487#ifndef CONFIG_SUSPEND_SKIP_SYNC
487 trace_suspend_resume(TPS("sync_filesystems"), 0, true); 488 trace_suspend_resume(TPS("sync_filesystems"), 0, true);
488 printk(KERN_INFO "PM: Syncing filesystems ... "); 489 printk(KERN_INFO "PM: Syncing filesystems ... ");
489 sys_sync(); 490 sys_sync();
490 printk("done.\n"); 491 printk("done.\n");
491 trace_suspend_resume(TPS("sync_filesystems"), 0, false); 492 trace_suspend_resume(TPS("sync_filesystems"), 0, false);
493#endif
492 494
493 pr_debug("PM: Preparing system for sleep (%s)\n", pm_states[state]); 495 pr_debug("PM: Preparing system for sleep (%s)\n", pm_states[state]);
494 error = suspend_prepare(state); 496 error = suspend_prepare(state);