diff options
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r-- | include/linux/freezer.h | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index deddeedf3257..8f225339eee9 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <linux/sched.h> | 6 | #include <linux/sched.h> |
7 | #include <linux/wait.h> | 7 | #include <linux/wait.h> |
8 | 8 | ||
9 | #ifdef CONFIG_PM_SLEEP | 9 | #ifdef CONFIG_FREEZER |
10 | /* | 10 | /* |
11 | * Check if a process has been frozen | 11 | * Check if a process has been frozen |
12 | */ | 12 | */ |
@@ -39,28 +39,18 @@ static inline void clear_freeze_flag(struct task_struct *p) | |||
39 | clear_tsk_thread_flag(p, TIF_FREEZE); | 39 | clear_tsk_thread_flag(p, TIF_FREEZE); |
40 | } | 40 | } |
41 | 41 | ||
42 | static inline bool should_send_signal(struct task_struct *p) | ||
43 | { | ||
44 | return !(p->flags & PF_FREEZER_NOSIG); | ||
45 | } | ||
46 | |||
42 | /* | 47 | /* |
43 | * Wake up a frozen process | 48 | * Wake up a frozen process |
44 | * | ||
45 | * task_lock() is taken to prevent the race with refrigerator() which may | ||
46 | * occur if the freezing of tasks fails. Namely, without the lock, if the | ||
47 | * freezing of tasks failed, thaw_tasks() might have run before a task in | ||
48 | * refrigerator() could call frozen_process(), in which case the task would be | ||
49 | * frozen and no one would thaw it. | ||
50 | */ | 49 | */ |
51 | static inline int thaw_process(struct task_struct *p) | 50 | extern int __thaw_process(struct task_struct *p); |
52 | { | 51 | |
53 | task_lock(p); | 52 | /* Takes and releases task alloc lock using task_lock() */ |
54 | if (frozen(p)) { | 53 | extern int thaw_process(struct task_struct *p); |
55 | p->flags &= ~PF_FROZEN; | ||
56 | task_unlock(p); | ||
57 | wake_up_process(p); | ||
58 | return 1; | ||
59 | } | ||
60 | clear_freeze_flag(p); | ||
61 | task_unlock(p); | ||
62 | return 0; | ||
63 | } | ||
64 | 54 | ||
65 | extern void refrigerator(void); | 55 | extern void refrigerator(void); |
66 | extern int freeze_processes(void); | 56 | extern int freeze_processes(void); |
@@ -75,6 +65,15 @@ static inline int try_to_freeze(void) | |||
75 | return 0; | 65 | return 0; |
76 | } | 66 | } |
77 | 67 | ||
68 | extern bool freeze_task(struct task_struct *p, bool sig_only); | ||
69 | extern void cancel_freezing(struct task_struct *p); | ||
70 | |||
71 | #ifdef CONFIG_CGROUP_FREEZER | ||
72 | extern int cgroup_frozen(struct task_struct *task); | ||
73 | #else /* !CONFIG_CGROUP_FREEZER */ | ||
74 | static inline int cgroup_frozen(struct task_struct *task) { return 0; } | ||
75 | #endif /* !CONFIG_CGROUP_FREEZER */ | ||
76 | |||
78 | /* | 77 | /* |
79 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it | 78 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it |
80 | * calls wait_for_completion(&vfork) and reset right after it returns from this | 79 | * calls wait_for_completion(&vfork) and reset right after it returns from this |
@@ -166,7 +165,7 @@ static inline void set_freezable_with_signal(void) | |||
166 | } while (try_to_freeze()); \ | 165 | } while (try_to_freeze()); \ |
167 | __retval; \ | 166 | __retval; \ |
168 | }) | 167 | }) |
169 | #else /* !CONFIG_PM_SLEEP */ | 168 | #else /* !CONFIG_FREEZER */ |
170 | static inline int frozen(struct task_struct *p) { return 0; } | 169 | static inline int frozen(struct task_struct *p) { return 0; } |
171 | static inline int freezing(struct task_struct *p) { return 0; } | 170 | static inline int freezing(struct task_struct *p) { return 0; } |
172 | static inline void set_freeze_flag(struct task_struct *p) {} | 171 | static inline void set_freeze_flag(struct task_struct *p) {} |
@@ -191,6 +190,6 @@ static inline void set_freezable_with_signal(void) {} | |||
191 | #define wait_event_freezable_timeout(wq, condition, timeout) \ | 190 | #define wait_event_freezable_timeout(wq, condition, timeout) \ |
192 | wait_event_interruptible_timeout(wq, condition, timeout) | 191 | wait_event_interruptible_timeout(wq, condition, timeout) |
193 | 192 | ||
194 | #endif /* !CONFIG_PM_SLEEP */ | 193 | #endif /* !CONFIG_FREEZER */ |
195 | 194 | ||
196 | #endif /* FREEZER_H_INCLUDED */ | 195 | #endif /* FREEZER_H_INCLUDED */ |