Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 1 | /* Freezer declarations */ |
| 2 | |
Rafael J. Wysocki | 8314418 | 2007-07-17 04:03:35 -0700 | [diff] [blame] | 3 | #ifndef FREEZER_H_INCLUDED |
| 4 | #define FREEZER_H_INCLUDED |
| 5 | |
Mandeep Singh Baines | e7f8bab | 2013-05-06 23:50:09 +0000 | [diff] [blame] | 6 | #include <linux/debug_locks.h> |
Randy Dunlap | 5c543ef | 2006-12-10 02:18:58 -0800 | [diff] [blame] | 7 | #include <linux/sched.h> |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 8 | #include <linux/wait.h> |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 9 | #include <linux/atomic.h> |
Randy Dunlap | 5c543ef | 2006-12-10 02:18:58 -0800 | [diff] [blame] | 10 | |
Matt Helsley | 8174f15 | 2008-10-18 20:27:19 -0700 | [diff] [blame] | 11 | #ifdef CONFIG_FREEZER |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 12 | extern atomic_t system_freezing_cnt; /* nr of freezing conds in effect */ |
| 13 | extern bool pm_freezing; /* PM freezing in effect */ |
| 14 | extern bool pm_nosig_freezing; /* PM nosig freezing in effect */ |
| 15 | |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 16 | /* |
| 17 | * Check if a process has been frozen |
| 18 | */ |
Tejun Heo | 948246f | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 19 | static inline bool frozen(struct task_struct *p) |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 20 | { |
| 21 | return p->flags & PF_FROZEN; |
| 22 | } |
| 23 | |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 24 | extern bool freezing_slow_path(struct task_struct *p); |
| 25 | |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 26 | /* |
| 27 | * Check if there is a request to freeze a process |
| 28 | */ |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 29 | static inline bool freezing(struct task_struct *p) |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 30 | { |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 31 | if (likely(!atomic_read(&system_freezing_cnt))) |
| 32 | return false; |
| 33 | return freezing_slow_path(p); |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 34 | } |
| 35 | |
Matt Helsley | dc52ddc | 2008-10-18 20:27:21 -0700 | [diff] [blame] | 36 | /* Takes and releases task alloc lock using task_lock() */ |
Tejun Heo | a5be2d0 | 2011-11-21 12:32:23 -0800 | [diff] [blame] | 37 | extern void __thaw_task(struct task_struct *t); |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 38 | |
Tejun Heo | 8a32c44 | 2011-11-21 12:32:23 -0800 | [diff] [blame] | 39 | extern bool __refrigerator(bool check_kthr_stop); |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 40 | extern int freeze_processes(void); |
Rafael J. Wysocki | 2aede85 | 2011-09-26 20:32:27 +0200 | [diff] [blame] | 41 | extern int freeze_kernel_threads(void); |
Rafael J. Wysocki | a9b6f56 | 2006-12-06 20:34:37 -0800 | [diff] [blame] | 42 | extern void thaw_processes(void); |
Rafael J. Wysocki | 181e9bd | 2012-01-29 20:35:52 +0100 | [diff] [blame] | 43 | extern void thaw_kernel_threads(void); |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 44 | |
Colin Cross | 8d43d95 | 2012-08-15 13:10:04 -0700 | [diff] [blame] | 45 | /* |
| 46 | * HACK: prevent sleeping while atomic warnings due to ARM signal handling |
| 47 | * disabling irqs |
| 48 | */ |
| 49 | static inline bool try_to_freeze_nowarn(void) |
| 50 | { |
| 51 | if (likely(!freezing(current))) |
| 52 | return false; |
| 53 | return __refrigerator(false); |
| 54 | } |
| 55 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 56 | /* |
| 57 | * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION |
| 58 | * If try_to_freeze causes a lockdep warning it means the caller may deadlock |
| 59 | */ |
| 60 | static inline bool try_to_freeze_unsafe(void) |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 61 | { |
Steve Muckle | dc0eed4 | 2012-05-23 08:49:36 -0700 | [diff] [blame] | 62 | /* This causes problems for ARM targets and is a known |
| 63 | * problem upstream. |
| 64 | * might_sleep(); |
| 65 | */ |
Tejun Heo | a0acae0 | 2011-11-21 12:32:22 -0800 | [diff] [blame] | 66 | if (likely(!freezing(current))) |
| 67 | return false; |
Tejun Heo | 8a32c44 | 2011-11-21 12:32:23 -0800 | [diff] [blame] | 68 | return __refrigerator(false); |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 69 | } |
Nigel Cunningham | ff39593 | 2006-12-06 20:34:28 -0800 | [diff] [blame] | 70 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 71 | static inline bool try_to_freeze(void) |
| 72 | { |
Mandeep Singh Baines | e7f8bab | 2013-05-06 23:50:09 +0000 | [diff] [blame] | 73 | if (!(current->flags & PF_NOFREEZE)) |
| 74 | debug_check_no_locks_held(); |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 75 | return try_to_freeze_unsafe(); |
| 76 | } |
| 77 | |
Tejun Heo | 839e340 | 2011-11-21 12:32:26 -0800 | [diff] [blame] | 78 | extern bool freeze_task(struct task_struct *p); |
Tejun Heo | 34b087e | 2011-11-23 09:28:17 -0800 | [diff] [blame] | 79 | extern bool set_freezable(void); |
Matt Helsley | 8174f15 | 2008-10-18 20:27:19 -0700 | [diff] [blame] | 80 | |
Matt Helsley | dc52ddc | 2008-10-18 20:27:21 -0700 | [diff] [blame] | 81 | #ifdef CONFIG_CGROUP_FREEZER |
Tejun Heo | 22b4e11 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 82 | extern bool cgroup_freezing(struct task_struct *task); |
Matt Helsley | dc52ddc | 2008-10-18 20:27:21 -0700 | [diff] [blame] | 83 | #else /* !CONFIG_CGROUP_FREEZER */ |
Tejun Heo | 22b4e11 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 84 | static inline bool cgroup_freezing(struct task_struct *task) |
Matt Helsley | 5a7aadf | 2010-03-26 23:51:44 +0100 | [diff] [blame] | 85 | { |
Tejun Heo | 22b4e11 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 86 | return false; |
Matt Helsley | 5a7aadf | 2010-03-26 23:51:44 +0100 | [diff] [blame] | 87 | } |
Matt Helsley | dc52ddc | 2008-10-18 20:27:21 -0700 | [diff] [blame] | 88 | #endif /* !CONFIG_CGROUP_FREEZER */ |
| 89 | |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 90 | /* |
| 91 | * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it |
| 92 | * calls wait_for_completion(&vfork) and reset right after it returns from this |
| 93 | * function. Next, the parent should call try_to_freeze() to freeze itself |
| 94 | * appropriately in case the child has exited before the freezing of tasks is |
| 95 | * complete. However, we don't want kernel threads to be frozen in unexpected |
| 96 | * places, so we allow them to block freeze_processes() instead or to set |
Srivatsa S. Bhat | 467de1f | 2011-12-06 23:17:51 +0100 | [diff] [blame] | 97 | * PF_NOFREEZE if needed. Fortunately, in the ____call_usermodehelper() case the |
| 98 | * parent won't really block freeze_processes(), since ____call_usermodehelper() |
| 99 | * (the child) does a little before exec/exit and it can't be frozen before |
| 100 | * waking up the parent. |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 101 | */ |
| 102 | |
Srivatsa S. Bhat | 467de1f | 2011-12-06 23:17:51 +0100 | [diff] [blame] | 103 | |
Tejun Heo | cd924e9 | 2012-10-16 15:03:14 -0700 | [diff] [blame] | 104 | /** |
| 105 | * freezer_do_not_count - tell freezer to ignore %current |
| 106 | * |
| 107 | * Tell freezers to ignore the current task when determining whether the |
| 108 | * target frozen state is reached. IOW, the current task will be |
| 109 | * considered frozen enough by freezers. |
| 110 | * |
| 111 | * The caller shouldn't do anything which isn't allowed for a frozen task |
| 112 | * until freezer_cont() is called. Usually, freezer[_do_not]_count() pair |
| 113 | * wrap a scheduling operation and nothing much else. |
| 114 | */ |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 115 | static inline void freezer_do_not_count(void) |
| 116 | { |
Srivatsa S. Bhat | 467de1f | 2011-12-06 23:17:51 +0100 | [diff] [blame] | 117 | current->flags |= PF_FREEZER_SKIP; |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 118 | } |
| 119 | |
Tejun Heo | cd924e9 | 2012-10-16 15:03:14 -0700 | [diff] [blame] | 120 | /** |
| 121 | * freezer_count - tell freezer to stop ignoring %current |
| 122 | * |
| 123 | * Undo freezer_do_not_count(). It tells freezers that %current should be |
| 124 | * considered again and tries to freeze if freezing condition is already in |
| 125 | * effect. |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 126 | */ |
| 127 | static inline void freezer_count(void) |
| 128 | { |
Srivatsa S. Bhat | 467de1f | 2011-12-06 23:17:51 +0100 | [diff] [blame] | 129 | current->flags &= ~PF_FREEZER_SKIP; |
Tejun Heo | cd924e9 | 2012-10-16 15:03:14 -0700 | [diff] [blame] | 130 | /* |
| 131 | * If freezing is in progress, the following paired with smp_mb() |
| 132 | * in freezer_should_skip() ensures that either we see %true |
| 133 | * freezing() or freezer_should_skip() sees !PF_FREEZER_SKIP. |
| 134 | */ |
| 135 | smp_mb(); |
Srivatsa S. Bhat | 467de1f | 2011-12-06 23:17:51 +0100 | [diff] [blame] | 136 | try_to_freeze(); |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 137 | } |
| 138 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 139 | /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ |
| 140 | static inline void freezer_count_unsafe(void) |
| 141 | { |
| 142 | current->flags &= ~PF_FREEZER_SKIP; |
| 143 | smp_mb(); |
| 144 | try_to_freeze_unsafe(); |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * freezer_should_skip - whether to skip a task when determining frozen |
| 149 | * state is reached |
| 150 | * @p: task in quesion |
| 151 | * |
| 152 | * This function is used by freezers after establishing %true freezing() to |
| 153 | * test whether a task should be skipped when determining the target frozen |
| 154 | * state is reached. IOW, if this function returns %true, @p is considered |
| 155 | * frozen enough. |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 156 | */ |
Tejun Heo | cd924e9 | 2012-10-16 15:03:14 -0700 | [diff] [blame] | 157 | static inline bool freezer_should_skip(struct task_struct *p) |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 158 | { |
Tejun Heo | cd924e9 | 2012-10-16 15:03:14 -0700 | [diff] [blame] | 159 | /* |
| 160 | * The following smp_mb() paired with the one in freezer_count() |
| 161 | * ensures that either freezer_count() sees %true freezing() or we |
| 162 | * see cleared %PF_FREEZER_SKIP and return %false. This makes it |
| 163 | * impossible for a task to slip frozen state testing after |
| 164 | * clearing %PF_FREEZER_SKIP. |
| 165 | */ |
| 166 | smp_mb(); |
| 167 | return p->flags & PF_FREEZER_SKIP; |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 168 | } |
Nigel Cunningham | ff39593 | 2006-12-06 20:34:28 -0800 | [diff] [blame] | 169 | |
Rafael J. Wysocki | 8314418 | 2007-07-17 04:03:35 -0700 | [diff] [blame] | 170 | /* |
Colin Cross | 13098dc | 2013-05-06 23:50:13 +0000 | [diff] [blame] | 171 | * These functions are intended to be used whenever you want allow a task that's |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 172 | * sleeping in TASK_UNINTERRUPTIBLE or TASK_KILLABLE state to be frozen. Note |
| 173 | * that neither return any clear indication of whether a freeze event happened |
| 174 | * while in this function. |
| 175 | */ |
| 176 | |
| 177 | /* Like schedule(), but should not block the freezer. */ |
Colin Cross | 13098dc | 2013-05-06 23:50:13 +0000 | [diff] [blame] | 178 | static inline void freezable_schedule(void) |
| 179 | { |
| 180 | freezer_do_not_count(); |
| 181 | schedule(); |
| 182 | freezer_count(); |
| 183 | } |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 184 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 185 | /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ |
Colin Cross | 13098dc | 2013-05-06 23:50:13 +0000 | [diff] [blame] | 186 | static inline void freezable_schedule_unsafe(void) |
| 187 | { |
| 188 | freezer_do_not_count(); |
| 189 | schedule(); |
| 190 | freezer_count_unsafe(); |
| 191 | } |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 192 | |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 193 | /* |
| 194 | * Like freezable_schedule_timeout(), but should not block the freezer. Do not |
| 195 | * call this with locks held. |
| 196 | */ |
| 197 | static inline long freezable_schedule_timeout(long timeout) |
| 198 | { |
| 199 | long __retval; |
| 200 | freezer_do_not_count(); |
| 201 | __retval = schedule_timeout(timeout); |
| 202 | freezer_count(); |
| 203 | return __retval; |
| 204 | } |
| 205 | |
| 206 | /* |
| 207 | * Like schedule_timeout_interruptible(), but should not block the freezer. Do not |
| 208 | * call this with locks held. |
| 209 | */ |
| 210 | static inline long freezable_schedule_timeout_interruptible(long timeout) |
| 211 | { |
| 212 | long __retval; |
| 213 | freezer_do_not_count(); |
| 214 | __retval = schedule_timeout_interruptible(timeout); |
| 215 | freezer_count(); |
| 216 | return __retval; |
| 217 | } |
| 218 | |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 219 | /* Like schedule_timeout_killable(), but should not block the freezer. */ |
Colin Cross | 13098dc | 2013-05-06 23:50:13 +0000 | [diff] [blame] | 220 | static inline long freezable_schedule_timeout_killable(long timeout) |
| 221 | { |
| 222 | long __retval; |
| 223 | freezer_do_not_count(); |
| 224 | __retval = schedule_timeout_killable(timeout); |
| 225 | freezer_count(); |
| 226 | return __retval; |
| 227 | } |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 228 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 229 | /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ |
Colin Cross | 13098dc | 2013-05-06 23:50:13 +0000 | [diff] [blame] | 230 | static inline long freezable_schedule_timeout_killable_unsafe(long timeout) |
| 231 | { |
| 232 | long __retval; |
| 233 | freezer_do_not_count(); |
| 234 | __retval = schedule_timeout_killable(timeout); |
| 235 | freezer_count_unsafe(); |
| 236 | return __retval; |
| 237 | } |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 238 | |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 239 | /* |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 240 | * Like schedule_hrtimeout_range(), but should not block the freezer. Do not |
| 241 | * call this with locks held. |
| 242 | */ |
| 243 | static inline int freezable_schedule_hrtimeout_range(ktime_t *expires, |
| 244 | unsigned long delta, const enum hrtimer_mode mode) |
| 245 | { |
| 246 | int __retval; |
| 247 | freezer_do_not_count(); |
| 248 | __retval = schedule_hrtimeout_range(expires, delta, mode); |
| 249 | freezer_count(); |
| 250 | return __retval; |
| 251 | } |
| 252 | |
| 253 | /* |
Jeff Layton | f06ac72 | 2011-10-19 15:30:40 -0400 | [diff] [blame] | 254 | * Freezer-friendly wrappers around wait_event_interruptible(), |
| 255 | * wait_event_killable() and wait_event_interruptible_timeout(), originally |
| 256 | * defined in <linux/wait.h> |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 257 | */ |
| 258 | |
Jeff Layton | f06ac72 | 2011-10-19 15:30:40 -0400 | [diff] [blame] | 259 | #define wait_event_freezekillable(wq, condition) \ |
| 260 | ({ \ |
| 261 | int __retval; \ |
Oleg Nesterov | 6f35c4a | 2011-11-03 16:07:49 -0700 | [diff] [blame] | 262 | freezer_do_not_count(); \ |
| 263 | __retval = wait_event_killable(wq, (condition)); \ |
| 264 | freezer_count(); \ |
Jeff Layton | f06ac72 | 2011-10-19 15:30:40 -0400 | [diff] [blame] | 265 | __retval; \ |
| 266 | }) |
| 267 | |
Colin Cross | cf46c3d | 2013-05-07 17:52:05 +0000 | [diff] [blame] | 268 | /* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ |
| 269 | #define wait_event_freezekillable_unsafe(wq, condition) \ |
| 270 | ({ \ |
| 271 | int __retval; \ |
| 272 | freezer_do_not_count(); \ |
| 273 | __retval = wait_event_killable(wq, (condition)); \ |
| 274 | freezer_count_unsafe(); \ |
| 275 | __retval; \ |
| 276 | }) |
| 277 | |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 278 | #define wait_event_freezable(wq, condition) \ |
| 279 | ({ \ |
| 280 | int __retval; \ |
Colin Cross | 3b78431 | 2013-05-06 23:50:12 +0000 | [diff] [blame] | 281 | freezer_do_not_count(); \ |
| 282 | __retval = wait_event_interruptible(wq, (condition)); \ |
| 283 | freezer_count(); \ |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 284 | __retval; \ |
| 285 | }) |
| 286 | |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 287 | #define wait_event_freezable_timeout(wq, condition, timeout) \ |
| 288 | ({ \ |
| 289 | long __retval = timeout; \ |
Colin Cross | 3b78431 | 2013-05-06 23:50:12 +0000 | [diff] [blame] | 290 | freezer_do_not_count(); \ |
| 291 | __retval = wait_event_interruptible_timeout(wq, (condition), \ |
| 292 | __retval); \ |
| 293 | freezer_count(); \ |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 294 | __retval; \ |
| 295 | }) |
Oleg Nesterov | 24b7ead | 2011-11-23 09:28:17 -0800 | [diff] [blame] | 296 | |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 297 | #define wait_event_freezable_exclusive(wq, condition) \ |
| 298 | ({ \ |
| 299 | int __retval; \ |
| 300 | freezer_do_not_count(); \ |
| 301 | __retval = wait_event_interruptible_exclusive(wq, condition); \ |
| 302 | freezer_count(); \ |
| 303 | __retval; \ |
| 304 | }) |
| 305 | |
| 306 | |
Matt Helsley | 8174f15 | 2008-10-18 20:27:19 -0700 | [diff] [blame] | 307 | #else /* !CONFIG_FREEZER */ |
Tejun Heo | 948246f | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 308 | static inline bool frozen(struct task_struct *p) { return false; } |
Tejun Heo | a320122 | 2011-11-21 12:32:25 -0800 | [diff] [blame] | 309 | static inline bool freezing(struct task_struct *p) { return false; } |
Stephen Rothwell | 62c9ea6 | 2011-11-25 00:44:55 +0100 | [diff] [blame] | 310 | static inline void __thaw_task(struct task_struct *t) {} |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 311 | |
Tejun Heo | 8a32c44 | 2011-11-21 12:32:23 -0800 | [diff] [blame] | 312 | static inline bool __refrigerator(bool check_kthr_stop) { return false; } |
Rafael J. Wysocki | 2aede85 | 2011-09-26 20:32:27 +0200 | [diff] [blame] | 313 | static inline int freeze_processes(void) { return -ENOSYS; } |
| 314 | static inline int freeze_kernel_threads(void) { return -ENOSYS; } |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 315 | static inline void thaw_processes(void) {} |
Rafael J. Wysocki | 181e9bd | 2012-01-29 20:35:52 +0100 | [diff] [blame] | 316 | static inline void thaw_kernel_threads(void) {} |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 317 | |
Ben Jones | c69159b | 2012-11-21 13:32:02 +0000 | [diff] [blame] | 318 | static inline bool try_to_freeze_nowarn(void) { return false; } |
Tejun Heo | a0acae0 | 2011-11-21 12:32:22 -0800 | [diff] [blame] | 319 | static inline bool try_to_freeze(void) { return false; } |
Nigel Cunningham | 7dfb710 | 2006-12-06 20:34:23 -0800 | [diff] [blame] | 320 | |
Rafael J. Wysocki | ba96a0c | 2007-05-23 13:57:25 -0700 | [diff] [blame] | 321 | static inline void freezer_do_not_count(void) {} |
| 322 | static inline void freezer_count(void) {} |
| 323 | static inline int freezer_should_skip(struct task_struct *p) { return 0; } |
Rafael J. Wysocki | 8314418 | 2007-07-17 04:03:35 -0700 | [diff] [blame] | 324 | static inline void set_freezable(void) {} |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 325 | |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 326 | #define freezable_schedule() schedule() |
| 327 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 328 | #define freezable_schedule_unsafe() schedule() |
| 329 | |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 330 | #define freezable_schedule_timeout(timeout) schedule_timeout(timeout) |
| 331 | |
| 332 | #define freezable_schedule_timeout_interruptible(timeout) \ |
| 333 | schedule_timeout_interruptible(timeout) |
| 334 | |
Jeff Layton | d310310 | 2011-12-01 22:44:39 +0100 | [diff] [blame] | 335 | #define freezable_schedule_timeout_killable(timeout) \ |
| 336 | schedule_timeout_killable(timeout) |
| 337 | |
Colin Cross | 3be9167 | 2013-05-06 23:50:06 +0000 | [diff] [blame] | 338 | #define freezable_schedule_timeout_killable_unsafe(timeout) \ |
| 339 | schedule_timeout_killable(timeout) |
| 340 | |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 341 | #define freezable_schedule_hrtimeout_range(expires, delta, mode) \ |
| 342 | schedule_hrtimeout_range(expires, delta, mode) |
| 343 | |
Rafael J. Wysocki | e42837b | 2007-10-18 03:04:45 -0700 | [diff] [blame] | 344 | #define wait_event_freezable(wq, condition) \ |
| 345 | wait_event_interruptible(wq, condition) |
| 346 | |
| 347 | #define wait_event_freezable_timeout(wq, condition, timeout) \ |
| 348 | wait_event_interruptible_timeout(wq, condition, timeout) |
| 349 | |
Colin Cross | 44cd98f | 2013-05-06 23:50:14 +0000 | [diff] [blame] | 350 | #define wait_event_freezable_exclusive(wq, condition) \ |
| 351 | wait_event_interruptible_exclusive(wq, condition) |
| 352 | |
Steve French | e0c8ea1 | 2011-10-25 10:02:53 -0500 | [diff] [blame] | 353 | #define wait_event_freezekillable(wq, condition) \ |
| 354 | wait_event_killable(wq, condition) |
| 355 | |
Colin Cross | cf46c3d | 2013-05-07 17:52:05 +0000 | [diff] [blame] | 356 | #define wait_event_freezekillable_unsafe(wq, condition) \ |
| 357 | wait_event_killable(wq, condition) |
| 358 | |
Matt Helsley | 8174f15 | 2008-10-18 20:27:19 -0700 | [diff] [blame] | 359 | #endif /* !CONFIG_FREEZER */ |
Rafael J. Wysocki | 8314418 | 2007-07-17 04:03:35 -0700 | [diff] [blame] | 360 | |
| 361 | #endif /* FREEZER_H_INCLUDED */ |