diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 20:16:53 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 20:16:53 -0400 |
| commit | 2031d0f586839bc68f35bcf8580b18947f8491d4 (patch) | |
| tree | e317615b4cb62350edeea0afe0a4fc94152cee29 /include/linux/sched.h | |
| parent | 98e7f29418a4931f97e6b78d1ef3a47103fe6cd5 (diff) | |
| parent | 3e1d1d28d99dabe63c64f7f40f1ca1d646de1f73 (diff) | |
Merge Christoph's freeze cleanup patch
Diffstat (limited to 'include/linux/sched.h')
| -rw-r--r-- | include/linux/sched.h | 73 |
1 files changed, 59 insertions, 14 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 98c109e4f43d..9530b1903160 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1265,33 +1265,78 @@ extern void normalize_rt_tasks(void); | |||
| 1265 | 1265 | ||
| 1266 | #endif | 1266 | #endif |
| 1267 | 1267 | ||
| 1268 | /* try_to_freeze | ||
| 1269 | * | ||
| 1270 | * Checks whether we need to enter the refrigerator | ||
| 1271 | * and returns 1 if we did so. | ||
| 1272 | */ | ||
| 1273 | #ifdef CONFIG_PM | 1268 | #ifdef CONFIG_PM |
| 1274 | extern void refrigerator(unsigned long); | 1269 | /* |
| 1270 | * Check if a process has been frozen | ||
| 1271 | */ | ||
| 1272 | static inline int frozen(struct task_struct *p) | ||
| 1273 | { | ||
| 1274 | return p->flags & PF_FROZEN; | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | /* | ||
| 1278 | * Check if there is a request to freeze a process | ||
| 1279 | */ | ||
| 1280 | static inline int freezing(struct task_struct *p) | ||
| 1281 | { | ||
| 1282 | return p->flags & PF_FREEZE; | ||
| 1283 | } | ||
| 1284 | |||
| 1285 | /* | ||
| 1286 | * Request that a process be frozen | ||
| 1287 | * FIXME: SMP problem. We may not modify other process' flags! | ||
| 1288 | */ | ||
| 1289 | static inline void freeze(struct task_struct *p) | ||
| 1290 | { | ||
| 1291 | p->flags |= PF_FREEZE; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | /* | ||
| 1295 | * Wake up a frozen process | ||
| 1296 | */ | ||
| 1297 | static inline int thaw_process(struct task_struct *p) | ||
| 1298 | { | ||
| 1299 | if (frozen(p)) { | ||
| 1300 | p->flags &= ~PF_FROZEN; | ||
| 1301 | wake_up_process(p); | ||
| 1302 | return 1; | ||
| 1303 | } | ||
| 1304 | return 0; | ||
| 1305 | } | ||
| 1306 | |||
| 1307 | /* | ||
| 1308 | * freezing is complete, mark process as frozen | ||
| 1309 | */ | ||
| 1310 | static inline void frozen_process(struct task_struct *p) | ||
| 1311 | { | ||
| 1312 | p->flags = (p->flags & ~PF_FREEZE) | PF_FROZEN; | ||
| 1313 | } | ||
| 1314 | |||
| 1315 | extern void refrigerator(void); | ||
| 1275 | extern int freeze_processes(void); | 1316 | extern int freeze_processes(void); |
| 1276 | extern void thaw_processes(void); | 1317 | extern void thaw_processes(void); |
| 1277 | 1318 | ||
| 1278 | static inline int try_to_freeze(unsigned long refrigerator_flags) | 1319 | static inline int try_to_freeze(void) |
| 1279 | { | 1320 | { |
| 1280 | if (unlikely(current->flags & PF_FREEZE)) { | 1321 | if (freezing(current)) { |
| 1281 | refrigerator(refrigerator_flags); | 1322 | refrigerator(); |
| 1282 | return 1; | 1323 | return 1; |
| 1283 | } else | 1324 | } else |
| 1284 | return 0; | 1325 | return 0; |
| 1285 | } | 1326 | } |
| 1286 | #else | 1327 | #else |
| 1287 | static inline void refrigerator(unsigned long flag) {} | 1328 | static inline int frozen(struct task_struct *p) { return 0; } |
| 1329 | static inline int freezing(struct task_struct *p) { return 0; } | ||
| 1330 | static inline void freeze(struct task_struct *p) { BUG(); } | ||
| 1331 | static inline int thaw_process(struct task_struct *p) { return 1; } | ||
| 1332 | static inline void frozen_process(struct task_struct *p) { BUG(); } | ||
| 1333 | |||
| 1334 | static inline void refrigerator(void) {} | ||
| 1288 | static inline int freeze_processes(void) { BUG(); return 0; } | 1335 | static inline int freeze_processes(void) { BUG(); return 0; } |
| 1289 | static inline void thaw_processes(void) {} | 1336 | static inline void thaw_processes(void) {} |
| 1290 | 1337 | ||
| 1291 | static inline int try_to_freeze(unsigned long refrigerator_flags) | 1338 | static inline int try_to_freeze(void) { return 0; } |
| 1292 | { | 1339 | |
| 1293 | return 0; | ||
| 1294 | } | ||
| 1295 | #endif /* CONFIG_PM */ | 1340 | #endif /* CONFIG_PM */ |
| 1296 | #endif /* __KERNEL__ */ | 1341 | #endif /* __KERNEL__ */ |
| 1297 | 1342 | ||
