linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Meurer <jonas@freesources.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-pm@vger.kernel.org, Pavel Machek <pavel@ucw.cz>,
	Len Brown <len.brown@intel.com>,
	Tim Dittler <tim.dittler@systemli.org>
Subject: [PATCH v2 2/2] PM: Change CONFIG_SUSPEND_SKIP_SYNC to CONFIG_SKIP_SYNC_ON_SUSPEND
Date: Mon, 14 Oct 2019 19:49:53 +0200	[thread overview]
Message-ID: <7f6b9ec9-b26f-8c13-6b0b-1d697bc1a7a9@freesources.org> (raw)
In-Reply-To: <063b2b9e-19f1-e67a-1d54-b1a813364bb8@freesources.org>

Rename the build-time switch CONFIG_SUSPEND_SKIP_SYNC to
CONFIG_SKIP_SYNC_ON_SUSPEND and slightly change its behaviour. Make it
configure the default for '/sys/power/sync_on_suspend', now that we have
a run-time switch for it.

Signed-off-by: Jonas Meurer <jonas@freesources.org>
---
 Documentation/ABI/testing/sysfs-power |    7 ++++---
 kernel/power/Kconfig                  |    7 +++++--
 kernel/power/main.c                   |    2 +-
 kernel/power/suspend.c                |    2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -575,7 +575,7 @@ static int enter_state(suspend_state_t s
 	if (state == PM_SUSPEND_TO_IDLE)
 		s2idle_begin();
 
-	if (!IS_ENABLED(CONFIG_SUSPEND_SKIP_SYNC) && sync_on_suspend_enabled) {
+	if (sync_on_suspend_enabled) {
 		trace_suspend_resume(TPS("sync_filesystems"), 0, true);
 		ksys_sync_helper();
 		trace_suspend_resume(TPS("sync_filesystems"), 0, false);
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -19,7 +19,7 @@ config SUSPEND_FREEZER
 
 	  Turning OFF this setting is NOT recommended! If in doubt, say Y.
 
-config SUSPEND_SKIP_SYNC
+config SKIP_SYNC_ON_SUSPEND
 	bool "Skip kernel's sys_sync() on suspend to RAM/standby"
 	depends on SUSPEND
 	depends on EXPERT
@@ -27,7 +27,10 @@ config SUSPEND_SKIP_SYNC
 	  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.
+	  user-space before invoking suspend.  There's a run-time switch
+	  at '/sys/power/sync_on_suspend' to configure this behaviour.
+	  This setting changes the default for the run-tim switch. Say Y
+	  to change the default to disable the kernel sys_sync().
 
 config HIBERNATE_CALLBACKS
 	bool
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -198,7 +198,7 @@ power_attr(mem_sleep);
  * show() returns whether ksys_sync_helper() is invoked before suspend.
  * store() accepts 0 or 1.  0 disables ksys_sync_helper() and 1 enables it.
  */
-bool sync_on_suspend_enabled = true;
+bool sync_on_suspend_enabled = !IS_ENABLED(CONFIG_SKIP_SYNC_ON_SUSPEND);
 
 static ssize_t sync_on_suspend_show(struct kobject *kobj,
 				   struct kobj_attribute *attr, char *buf)
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -312,6 +312,7 @@ Description:
 		aware that you have to take care of sync() yourself before
 		suspending the system if you disable it here.
 
-		Writing a "1" (default) to this file enables the sync() and
-		writing a "0" disables it. Reads from the file return the
-		current value.
+		Writing a "1" to this file enables the sync() and writing a
+		"0" disables it. Reads from the file return the current value.
+		The default is "1" but can be configured with the build-time
+		config flag "SKIP_SYNC_ON_SUSPEND".

  parent reply	other threads:[~2019-10-14 17:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 10:50 [RFC PATCH] PM: Add a switch for disabling/enabling sync() before suspend Jonas Meurer
2019-10-10 15:00 ` Jonas Meurer
2019-10-11 10:22 ` Rafael J. Wysocki
2019-10-14 17:46   ` Jonas Meurer
2019-10-14 17:48     ` [PATCH v2 1/2] " Jonas Meurer
2019-10-14 17:49     ` Jonas Meurer [this message]
2019-11-04 10:51       ` [PATCH v3 2/2] PM: CONFIG_SUSPEND_SKIP_SYNC sets default for '/sys/power/sync_on_suspend' Jonas Meurer
2019-10-21 10:47     ` [RFC PATCH] PM: Add a switch for disabling/enabling sync() before suspend Jonas Meurer
2019-10-21 21:47       ` Rafael J. Wysocki
2019-10-22  8:54         ` Jonas Meurer
2019-11-04 10:57           ` Jonas Meurer
2019-11-12 11:00             ` Jonas Meurer
2019-12-02 14:12               ` Yannik Sembritzki
2019-12-02 17:05                 ` Jonas Meurer
2019-10-22 10:39       ` Pavel Machek
2019-10-31 15:56         ` Jonas Meurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f6b9ec9-b26f-8c13-6b0b-1d697bc1a7a9@freesources.org \
    --to=jonas@freesources.org \
    --cc=len.brown@intel.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=tim.dittler@systemli.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).