From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: rjw@sisk.pl
Cc: pavel@ucw.cz, len.brown@intel.com, tj@kernel.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
Subject: [PATCH v2 2/4] PM/Freezer: Make thaw_processes() thaw only userspace tasks
Date: Tue, 31 Jan 2012 04:44:48 +0530 [thread overview]
Message-ID: <20120130231437.11129.3708.stgit@srivatsabhat.in.ibm.com> (raw)
In-Reply-To: <20120130231342.11129.87187.stgit@srivatsabhat.in.ibm.com>
Currently the situation is:
freeze_processes() - freezes only userspace tasks
freeze_kernel_threads() - freezes only kernel threads
thaw_kernel_threads() - thaws only kernel threads
thaw_processes() - thaws *everything* (both userspace tasks and kernel threads)
The point that thaw_processes() thaws everything is rather unintuitive
and can lead to bugs. So, modify thaw_processes() so that it thaws only
userspace processes. This way we can also have more control over what
exactly gets thawed in different situations.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
---
kernel/power/process.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/power/process.c b/kernel/power/process.c
index 3734fb9..8ae6c4b 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -116,7 +116,8 @@ static int try_to_freeze_tasks(bool user_only)
/**
* freeze_processes - Signal user space processes to enter the refrigerator.
*
- * On success, returns 0. On failure, -errno and system is fully thawed.
+ * On success, returns 0. On failure, -errno and all user space processes
+ * are thawed.
*/
int freeze_processes(void)
{
@@ -170,17 +171,15 @@ void thaw_processes(void)
if (pm_freezing)
atomic_dec(&system_freezing_cnt);
pm_freezing = false;
- pm_nosig_freezing = false;
oom_killer_enable();
printk("Restarting tasks ... ");
- thaw_workqueues();
-
read_lock(&tasklist_lock);
do_each_thread(g, p) {
- __thaw_task(p);
+ if (!(p->flags & (PF_KTHREAD | PF_WQ_WORKER)))
+ __thaw_task(p);
} while_each_thread(g, p);
read_unlock(&tasklist_lock);
next prev parent reply other threads:[~2012-01-30 23:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 23:14 [PATCH v2 0/4] PM / Freezer: Fix the semantics of thaw_processes() and thaw_kernel_threads() Srivatsa S. Bhat
2012-01-30 23:14 ` [PATCH v2 1/4] PM/Freezer: Use thaw_kernel_threads() in preparation for changes to thaw_processes() Srivatsa S. Bhat
2012-01-30 23:14 ` Srivatsa S. Bhat [this message]
2012-01-30 23:30 ` [PATCH v2 2/4] PM/Freezer: Make thaw_processes() thaw only userspace tasks Tejun Heo
2012-01-31 0:09 ` Srivatsa S. Bhat
2012-01-31 0:12 ` Tejun Heo
2012-02-01 14:03 ` Pavel Machek
2012-01-30 23:15 ` [PATCH v2 3/4] PM/Hibernate: Thaw kernel threads in hibernation_snapshot() in error/test path Srivatsa S. Bhat
2012-01-30 23:15 ` [PATCH v2 4/4] PM/Hibernate: Refactor and simplify freezer_test_done Srivatsa S. Bhat
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=20120130231437.11129.3708.stgit@srivatsabhat.in.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=tj@kernel.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).