suspend: make sync() on suspend-to-RAM build-time optional
Subsystems (2)
Len Brown
reviewerv5 cover suspend: make sync() on suspend-to-RAM build-time optional
Based on discussion resulting from...
https://lkml.org/lkml/2015/5/8/82
[PATCH 1/1] suspend: delete sys_sync()
https://lkml.org/lkml/2015/7/14/896
[PATCH v4 0/1] suspend: make sync() on suspend-to-RAM optional
this patch makes sys_sync() optional at build time, rather than deleting it entirely.
cheers,
Len Brown, Intel Open Source Technology Center
Len Brown
reviewerPATCH v5 1/1 suspend: make sync() on suspend-to-RAM build-time optional
From: Len Brown <[email protected]>
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.
--- kernel/power/Kconfig | 10 ++++++++++ kernel/power/suspend.c | 2 ++ 2 files changed, 12 insertions(+)
kernel/power/Kconfig +10 -0
@@ -18,6 +18,16 @@ config SUSPEND_FREEZER 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 + Delete the kernel sys_sync() before freezing user processes. + Some operating 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. + config HIBERNATE_CALLBACKS bool
kernel/power/suspend.c +2 -0
@@ -482,11 +482,13 @@ static int enter_state(suspend_state_t state)if (state ==PM_SUSPEND_FREEZE )freeze_begin (); +#ifndef CONFIG_SUSPEND_SKIP_SYNC trace_suspend_resume (TPS ("sync_filesystems" ),0 , true);printk (KERN_INFO "PM: Syncing filesystems ... " );sys_sync ();printk ("done.\n" );trace_suspend_resume (TPS ("sync_filesystems" ),0 , false); +#endif pr_debug ("PM: Preparing system for %s sleep\n" , pm_states[state]); error =suspend_prepare (state);
Signature · 1 line
2.5.0
Quoted 9 lines · Len Brown
From: Len Brown <[email protected]>
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 ofsys_sync()on every suspend -- preferring invokesync()from user-space if/when they want it.
Quoted 5 lines
So make
sys_syncon suspend build-time optional.The default is unchanged.
Signed-off-by Len Brown <[email protected]>
OK, I'm replacing your previous sync patch with this one (modulo some minor changes in the help text).
Thanks,
Rafael