aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/suspend.h
diff options
context:
space:
mode:
authorSrivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>2011-11-21 17:32:35 -0500
committerRafael J. Wysocki <rjw@sisk.pl>2011-11-23 15:13:16 -0500
commit6a76b7a9cc93dec6ae58d70f1257d234291908e0 (patch)
tree4f9d44d2643b96f7ec7245734ef869bd2b1a3600 /include/linux/suspend.h
parent341d4166175e9b7911444f5a33b1c9efb8f15c85 (diff)
PM / Memory-hotplug: Avoid task freezing failures
The lock_system_sleep() function is used in the memory hotplug code at several places in order to implement mutual exclusion with hibernation. However, this function tries to acquire the 'pm_mutex' lock using mutex_lock() and hence blocks in TASK_UNINTERRUPTIBLE state if it doesn't get the lock. This would lead to task freezing failures and hence hibernation failure as a consequence, even though the hibernation call path successfully acquired the lock. But it is to be noted that, since this task tries to acquire pm_mutex, if it blocks due to this, we are *100% sure* that this task is not going to run as long as hibernation sequence is in progress, since hibernation releases 'pm_mutex' only at the very end, when everything is done. And this means, this task is going to be anyway blocked for much more longer than what the freezer intends to achieve; which means, freezing and thawing doesn't really make any difference to this task! So, to fix freezing failures, we just ask the freezer to skip freezing this task, since it is already "frozen enough". But instead of calling freezer_do_not_count() and freezer_count() as it is, we use only the relevant parts of those functions, because restrictions such as 'the task should be a userspace one' etc., might not be relevant in this scenario. Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> Acked-by: Tejun Heo <tj@kernel.org> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'include/linux/suspend.h')
-rw-r--r--include/linux/suspend.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 57a692432f8a..1f7fff47cfac 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -380,12 +380,16 @@ static inline void unlock_system_sleep(void) {}
380 380
381static inline void lock_system_sleep(void) 381static inline void lock_system_sleep(void)
382{ 382{
383 /* simplified freezer_do_not_count() */
384 current->flags |= PF_FREEZER_SKIP;
383 mutex_lock(&pm_mutex); 385 mutex_lock(&pm_mutex);
384} 386}
385 387
386static inline void unlock_system_sleep(void) 388static inline void unlock_system_sleep(void)
387{ 389{
388 mutex_unlock(&pm_mutex); 390 mutex_unlock(&pm_mutex);
391 /* simplified freezer_count() */
392 current->flags &= ~PF_FREEZER_SKIP;
389} 393}
390#endif 394#endif
391 395