public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] suspend: enable freeze timeout configuration through sysctl
@ 2013-01-29  2:58 fli24
  2013-01-29 11:42 ` Rafael J. Wysocki
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: fli24 @ 2013-01-29  2:58 UTC (permalink / raw)
  To: rjw, akpm; +Cc: linux-kernel, linux-pm, chuansheng.liu, fei.li


At present, the timeout value for freezing tasks is fixed as 20s,
which is too long for handheld device usage, especially for mobile
phone.

In order to improve user experience, we enable freeze timeout
configuration through sysctl, so that we can tune the value easily
for concrete usage, such as smaller value for handheld device such
as mobile phone.

Signed-off-by: Liu Chuansheng <chuansheng.liu@intel.com>
Signed-off-by: Li Fei <fei.li@intel.com>
---
 include/linux/freezer.h |    5 +++++
 kernel/power/process.c  |    4 ++--
 kernel/sysctl.c         |   12 ++++++++++++
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index e4238ce..f37b3be 100644
--- a/include/linux/freezer.h
+++ b/include/linux/freezer.h
@@ -13,6 +13,11 @@ extern bool pm_freezing;		/* PM freezing in effect */
 extern bool pm_nosig_freezing;		/* PM nosig freezing in effect */
 
 /*
+ * Timeout for stopping processes
+ */
+extern unsigned int sysctl_freeze_process_timeout_secs;
+
+/*
  * Check if a process has been frozen
  */
 static inline bool frozen(struct task_struct *p)
diff --git a/kernel/power/process.c b/kernel/power/process.c
index d5a258b..f7eb7c9 100644
--- a/kernel/power/process.c
+++ b/kernel/power/process.c
@@ -21,7 +21,7 @@
 /* 
  * Timeout for stopping processes
  */
-#define TIMEOUT	(20 * HZ)
+unsigned int __read_mostly sysctl_freeze_process_timeout_secs = 20;
 
 static int try_to_freeze_tasks(bool user_only)
 {
@@ -36,7 +36,7 @@ static int try_to_freeze_tasks(bool user_only)
 
 	do_gettimeofday(&start);
 
-	end_time = jiffies + TIMEOUT;
+	end_time = jiffies + sysctl_freeze_process_timeout_secs * HZ;
 
 	if (!user_only)
 		freeze_workqueues_begin();
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c88878d..f88bcb9 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -90,6 +90,9 @@
 #include <linux/nmi.h>
 #endif
 
+#ifdef CONFIG_FREEZER
+#include <linux/freezer.h>
+#endif
 
 #if defined(CONFIG_SYSCTL)
 
@@ -1047,6 +1050,15 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_dointvec,
 	},
 #endif
+#ifdef CONFIG_FREEZER
+	{
+		.procname	= "freeze_process_timeout_secs",
+		.data		= &sysctl_freeze_process_timeout_secs,
+		.maxlen		= sizeof(unsigned int),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec,
+	},
+#endif
 	{ }
 };
 
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2013-02-04 12:16 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29  2:58 [PATCH] suspend: enable freeze timeout configuration through sysctl fli24
2013-01-29 11:42 ` Rafael J. Wysocki
2013-01-30  6:22   ` Li, Fei
2013-01-30  0:36 ` Andrew Morton
2013-01-30  6:23   ` Li, Fei
2013-01-30  6:23 ` [PATCH V2] suspend: enable freeze timeout configuration through sys fli24
2013-01-30 13:09   ` Rafael J. Wysocki
2013-01-31  5:00     ` Li, Fei
2013-01-31  4:55   ` [PATCH V3] " fli24
2013-01-31  7:29     ` Yasuaki Ishimatsu
2013-01-31  9:13       ` Li, Fei
2013-01-31  9:52         ` anish singh
2013-01-31 22:29           ` Rafael J. Wysocki
2013-02-01  1:33             ` Li, Fei
2013-02-01  1:56               ` Yasuaki Ishimatsu
2013-02-01  2:02                 ` Liu, Chuansheng
2013-02-01  8:56     ` [PATCH V4] " fli24
2013-02-03 13:41       ` Rafael J. Wysocki
2013-02-04  3:08         ` Li, Fei
2013-02-04  3:15           ` Alan Stern
2013-02-04  4:32             ` Liu, Chuansheng
2013-02-04 12:22               ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox