Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351000
b: refs/heads/master
c: 957d128
h: refs/heads/master
v: v3
  • Loading branch information
Li Fei authored and Rafael J. Wysocki committed Feb 9, 2013
1 parent c91cc17 commit 25e8cf3
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 89a22dadb8810983868f5bbbc5530b27bf714a60
refs/heads/master: 957d1282bb8c07e682e142b9237cd9fcb8348a0b
5 changes: 5 additions & 0 deletions trunk/Documentation/power/freezing-of-tasks.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,8 @@ since they ask the freezer to skip freezing this task, since it is anyway
only after the entire suspend/hibernation sequence is complete.
So, to summarize, use [un]lock_system_sleep() instead of directly using
mutex_[un]lock(&pm_mutex). That would prevent freezing failures.

V. Miscellaneous
/sys/power/pm_freeze_timeout controls how long it will cost at most to freeze
all user space processes or all freezable kernel threads, in unit of millisecond.
The default value is 20000, with range of unsigned integer.
5 changes: 5 additions & 0 deletions trunk/include/linux/freezer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */
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 freeze_timeout_msecs;

/*
* Check if a process has been frozen
*/
Expand Down
27 changes: 27 additions & 0 deletions trunk/kernel/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,30 @@ power_attr(pm_trace_dev_match);

#endif /* CONFIG_PM_TRACE */

#ifdef CONFIG_FREEZER
static ssize_t pm_freeze_timeout_show(struct kobject *kobj,
struct kobj_attribute *attr, char *buf)
{
return sprintf(buf, "%u\n", freeze_timeout_msecs);
}

static ssize_t pm_freeze_timeout_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t n)
{
unsigned long val;

if (kstrtoul(buf, 10, &val))
return -EINVAL;

freeze_timeout_msecs = val;
return n;
}

power_attr(pm_freeze_timeout);

#endif /* CONFIG_FREEZER*/

static struct attribute * g[] = {
&state_attr.attr,
#ifdef CONFIG_PM_TRACE
Expand All @@ -575,6 +599,9 @@ static struct attribute * g[] = {
#ifdef CONFIG_PM_SLEEP_DEBUG
&pm_print_times_attr.attr,
#endif
#endif
#ifdef CONFIG_FREEZER
&pm_freeze_timeout_attr.attr,
#endif
NULL,
};
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/power/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/*
* Timeout for stopping processes
*/
#define TIMEOUT (20 * HZ)
unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC;

static int try_to_freeze_tasks(bool user_only)
{
Expand All @@ -36,7 +36,7 @@ static int try_to_freeze_tasks(bool user_only)

do_gettimeofday(&start);

end_time = jiffies + TIMEOUT;
end_time = jiffies + msecs_to_jiffies(freeze_timeout_msecs);

if (!user_only)
freeze_workqueues_begin();
Expand Down

0 comments on commit 25e8cf3

Please sign in to comment.