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>
This commit is contained in:
parent
019d8817b1
commit
2fd77fff4b
@ -18,6 +18,16 @@ config SUSPEND_FREEZER
|
|||||||
|
|
||||||
Turning OFF this setting is NOT recommended! If in doubt, say Y.
|
Turning OFF this setting is NOT recommended! If in doubt, say Y.
|
||||||
|
|
||||||
|
config SUSPEND_SKIP_SYNC
|
||||||
|
bool "Skip kernel's sys_sync() on suspend to RAM/standby"
|
||||||
|
depends on SUSPEND
|
||||||
|
depends on EXPERT
|
||||||
|
help
|
||||||
|
Skip the kernel sys_sync() before freezing user processes.
|
||||||
|
Some systems prefer not to pay this cost on every invocation
|
||||||
|
of suspend, or they are content with invoking sync() from
|
||||||
|
user-space before invoking suspend. Say Y if that's your case.
|
||||||
|
|
||||||
config HIBERNATE_CALLBACKS
|
config HIBERNATE_CALLBACKS
|
||||||
bool
|
bool
|
||||||
|
|
||||||
|
@ -484,11 +484,13 @@ static int enter_state(suspend_state_t state)
|
|||||||
if (state == PM_SUSPEND_FREEZE)
|
if (state == PM_SUSPEND_FREEZE)
|
||||||
freeze_begin();
|
freeze_begin();
|
||||||
|
|
||||||
|
#ifndef CONFIG_SUSPEND_SKIP_SYNC
|
||||||
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
|
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
|
||||||
printk(KERN_INFO "PM: Syncing filesystems ... ");
|
printk(KERN_INFO "PM: Syncing filesystems ... ");
|
||||||
sys_sync();
|
sys_sync();
|
||||||
printk("done.\n");
|
printk("done.\n");
|
||||||
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
|
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
|
||||||
|
#endif
|
||||||
|
|
||||||
pr_debug("PM: Preparing system for sleep (%s)\n", pm_states[state]);
|
pr_debug("PM: Preparing system for sleep (%s)\n", pm_states[state]);
|
||||||
error = suspend_prepare(state);
|
error = suspend_prepare(state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user