diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/power/main.c | 27 | ||||
| -rw-r--r-- | kernel/power/process.c | 4 |
2 files changed, 29 insertions, 2 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index b1c26a92ca9f..d77663bfedeb 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -553,6 +553,30 @@ power_attr(pm_trace_dev_match); | |||
| 553 | 553 | ||
| 554 | #endif /* CONFIG_PM_TRACE */ | 554 | #endif /* CONFIG_PM_TRACE */ |
| 555 | 555 | ||
| 556 | #ifdef CONFIG_FREEZER | ||
| 557 | static ssize_t pm_freeze_timeout_show(struct kobject *kobj, | ||
| 558 | struct kobj_attribute *attr, char *buf) | ||
| 559 | { | ||
| 560 | return sprintf(buf, "%u\n", freeze_timeout_msecs); | ||
| 561 | } | ||
| 562 | |||
| 563 | static ssize_t pm_freeze_timeout_store(struct kobject *kobj, | ||
| 564 | struct kobj_attribute *attr, | ||
| 565 | const char *buf, size_t n) | ||
| 566 | { | ||
| 567 | unsigned long val; | ||
| 568 | |||
| 569 | if (kstrtoul(buf, 10, &val)) | ||
| 570 | return -EINVAL; | ||
| 571 | |||
| 572 | freeze_timeout_msecs = val; | ||
| 573 | return n; | ||
| 574 | } | ||
| 575 | |||
| 576 | power_attr(pm_freeze_timeout); | ||
| 577 | |||
| 578 | #endif /* CONFIG_FREEZER*/ | ||
| 579 | |||
| 556 | static struct attribute * g[] = { | 580 | static struct attribute * g[] = { |
| 557 | &state_attr.attr, | 581 | &state_attr.attr, |
| 558 | #ifdef CONFIG_PM_TRACE | 582 | #ifdef CONFIG_PM_TRACE |
| @@ -576,6 +600,9 @@ static struct attribute * g[] = { | |||
| 576 | &pm_print_times_attr.attr, | 600 | &pm_print_times_attr.attr, |
| 577 | #endif | 601 | #endif |
| 578 | #endif | 602 | #endif |
| 603 | #ifdef CONFIG_FREEZER | ||
| 604 | &pm_freeze_timeout_attr.attr, | ||
| 605 | #endif | ||
| 579 | NULL, | 606 | NULL, |
| 580 | }; | 607 | }; |
| 581 | 608 | ||
diff --git a/kernel/power/process.c b/kernel/power/process.c index d5a258b60c6f..98088e0e71e8 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | /* | 21 | /* |
| 22 | * Timeout for stopping processes | 22 | * Timeout for stopping processes |
| 23 | */ | 23 | */ |
| 24 | #define TIMEOUT (20 * HZ) | 24 | unsigned int __read_mostly freeze_timeout_msecs = 20 * MSEC_PER_SEC; |
| 25 | 25 | ||
| 26 | static int try_to_freeze_tasks(bool user_only) | 26 | static int try_to_freeze_tasks(bool user_only) |
| 27 | { | 27 | { |
| @@ -36,7 +36,7 @@ static int try_to_freeze_tasks(bool user_only) | |||
| 36 | 36 | ||
| 37 | do_gettimeofday(&start); | 37 | do_gettimeofday(&start); |
| 38 | 38 | ||
| 39 | end_time = jiffies + TIMEOUT; | 39 | end_time = jiffies + msecs_to_jiffies(freeze_timeout_msecs); |
| 40 | 40 | ||
| 41 | if (!user_only) | 41 | if (!user_only) |
| 42 | freeze_workqueues_begin(); | 42 | freeze_workqueues_begin(); |
