aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/freezer.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2011-11-21 15:32:22 -0500
committerTejun Heo <tj@kernel.org>2011-11-21 15:32:22 -0500
commita0acae0e886d44bd5ce6d2f173c1ace0fcf0d9f6 (patch)
tree0b763388360a5a9043986e1f2201e43df74ebc46 /kernel/freezer.c
parent3a7cbd50f74907580eb47a8d08e1f29741b81abf (diff)
freezer: unexport refrigerator() and update try_to_freeze() slightly
There is no reason to export two functions for entering the refrigerator. Calling refrigerator() instead of try_to_freeze() doesn't save anything noticeable or removes any race condition. * Rename refrigerator() to __refrigerator() and make it return bool indicating whether it scheduled out for freezing. * Update try_to_freeze() to return bool and relay the return value of __refrigerator() if freezing(). * Convert all refrigerator() users to try_to_freeze(). * Update documentation accordingly. * While at it, add might_sleep() to try_to_freeze(). Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Samuel Ortiz <samuel@sortiz.org> Cc: Chris Mason <chris.mason@oracle.com> Cc: "Theodore Ts'o" <tytso@mit.edu> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jan Kara <jack@suse.cz> Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp> Cc: Christoph Hellwig <hch@infradead.org>
Diffstat (limited to 'kernel/freezer.c')
-rw-r--r--kernel/freezer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/freezer.c b/kernel/freezer.c
index 3f460104a9d6..732f14f5944f 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -23,10 +23,11 @@ static inline void frozen_process(void)
23} 23}
24 24
25/* Refrigerator is place where frozen processes are stored :-). */ 25/* Refrigerator is place where frozen processes are stored :-). */
26void refrigerator(void) 26bool __refrigerator(void)
27{ 27{
28 /* Hmm, should we be allowed to suspend when there are realtime 28 /* Hmm, should we be allowed to suspend when there are realtime
29 processes around? */ 29 processes around? */
30 bool was_frozen = false;
30 long save; 31 long save;
31 32
32 task_lock(current); 33 task_lock(current);
@@ -35,7 +36,7 @@ void refrigerator(void)
35 task_unlock(current); 36 task_unlock(current);
36 } else { 37 } else {
37 task_unlock(current); 38 task_unlock(current);
38 return; 39 return was_frozen;
39 } 40 }
40 save = current->state; 41 save = current->state;
41 pr_debug("%s entered refrigerator\n", current->comm); 42 pr_debug("%s entered refrigerator\n", current->comm);
@@ -51,6 +52,7 @@ void refrigerator(void)
51 set_current_state(TASK_UNINTERRUPTIBLE); 52 set_current_state(TASK_UNINTERRUPTIBLE);
52 if (!frozen(current)) 53 if (!frozen(current))
53 break; 54 break;
55 was_frozen = true;
54 schedule(); 56 schedule();
55 } 57 }
56 58
@@ -65,8 +67,10 @@ void refrigerator(void)
65 * synchronization which depends on ordered task state change. 67 * synchronization which depends on ordered task state change.
66 */ 68 */
67 set_current_state(save); 69 set_current_state(save);
70
71 return was_frozen;
68} 72}
69EXPORT_SYMBOL(refrigerator); 73EXPORT_SYMBOL(__refrigerator);
70 74
71static void fake_signal_wake_up(struct task_struct *p) 75static void fake_signal_wake_up(struct task_struct *p)
72{ 76{