From: Jonas Meurer <jonas@freesources.org>
To: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>,
Tim Dittler <tim.dittler@systemli.org>,
Yannik Sembritzki <yannik@sembritzki.me>
Subject: [PATCH 2/2] PM: CONFIG_SUSPEND_SKIP_SYNC sets default for, '/sys/power/sync_on_suspend'
Date: Mon, 2 Dec 2019 18:07:43 +0100 [thread overview]
Message-ID: <5c3996e1-eee7-1b8f-51bf-a6401d229bff@freesources.org> (raw)
In-Reply-To: <1ee5b9ef-f30e-3fde-2325-ba516a96ced5@freesources.org>
Slightly change the behaviour of build-time switch CONFIG_SUSPEND_SKIP_SYNC:
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 | 5 ++++-
kernel/power/main.c | 2 +-
kernel/power/suspend.c | 2 +-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Documentation/ABI/testing/sysfs-power b/Documentation/ABI/testing/sysfs-power
index f164a364e89a..783b3ce8eb06 100644
--- a/Documentation/ABI/testing/sysfs-power
+++ b/Documentation/ABI/testing/sysfs-power
@@ -418,6 +418,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 "SUSPEND_SKIP_SYNC".
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig
index d3667b4075c1..7cbfbeacd68a 100644
--- a/kernel/power/Kconfig
+++ b/kernel/power/Kconfig
@@ -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
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 7d9d579a8e6f..69b7a8aeca3b 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -197,7 +197,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_SUSPEND_SKIP_SYNC);
static ssize_t sync_on_suspend_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 503d56419a69..2c47280fbfc7 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -564,7 +564,7 @@ static int enter_state(suspend_state_t state)
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);
--
2.20.1
next prev parent reply other threads:[~2019-12-02 17:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 17:05 [PATCH 0/2] PM: Add a switch for disabling/enabling sync() before suspend Jonas Meurer
2019-12-02 17:07 ` [PATCH 1/2] PM: Add a switch for disabling/enabling sync() before, suspend Jonas Meurer
2019-12-14 9:13 ` Pavel Machek
2019-12-16 16:54 ` Jonas Meurer
2019-12-02 17:07 ` Jonas Meurer [this message]
2019-12-20 9:35 ` [PATCH 2/2] PM: CONFIG_SUSPEND_SKIP_SYNC sets default for, '/sys/power/sync_on_suspend' Rafael J. Wysocki
2019-12-20 16:06 ` Jonas Meurer
2019-12-11 15:59 ` [PATCH 0/2] PM: Add a switch for disabling/enabling sync() before suspend Jonas Meurer
2019-12-12 18:00 ` Rafael J. Wysocki
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=5c3996e1-eee7-1b8f-51bf-a6401d229bff@freesources.org \
--to=jonas@freesources.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=tim.dittler@systemli.org \
--cc=yannik@sembritzki.me \
/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