diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/cgroup_subsys.h | 6 | ||||
-rw-r--r-- | include/linux/freezer.h | 29 |
2 files changed, 16 insertions, 19 deletions
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h index e2877454ec82..9c22396e8b50 100644 --- a/include/linux/cgroup_subsys.h +++ b/include/linux/cgroup_subsys.h | |||
@@ -48,3 +48,9 @@ SUBSYS(devices) | |||
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | /* */ | 50 | /* */ |
51 | |||
52 | #ifdef CONFIG_CGROUP_FREEZER | ||
53 | SUBSYS(freezer) | ||
54 | #endif | ||
55 | |||
56 | /* */ | ||
diff --git a/include/linux/freezer.h b/include/linux/freezer.h index 17e3bb42dd3c..8f225339eee9 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h | |||
@@ -46,26 +46,11 @@ static inline bool should_send_signal(struct task_struct *p) | |||
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Wake up a frozen process | 48 | * Wake up a frozen process |
49 | * | ||
50 | * task_lock() is taken to prevent the race with refrigerator() which may | ||
51 | * occur if the freezing of tasks fails. Namely, without the lock, if the | ||
52 | * freezing of tasks failed, thaw_tasks() might have run before a task in | ||
53 | * refrigerator() could call frozen_process(), in which case the task would be | ||
54 | * frozen and no one would thaw it. | ||
55 | */ | 49 | */ |
56 | static inline int thaw_process(struct task_struct *p) | 50 | extern int __thaw_process(struct task_struct *p); |
57 | { | 51 | |
58 | task_lock(p); | 52 | /* Takes and releases task alloc lock using task_lock() */ |
59 | if (frozen(p)) { | 53 | extern int thaw_process(struct task_struct *p); |
60 | p->flags &= ~PF_FROZEN; | ||
61 | task_unlock(p); | ||
62 | wake_up_process(p); | ||
63 | return 1; | ||
64 | } | ||
65 | clear_freeze_flag(p); | ||
66 | task_unlock(p); | ||
67 | return 0; | ||
68 | } | ||
69 | 54 | ||
70 | extern void refrigerator(void); | 55 | extern void refrigerator(void); |
71 | extern int freeze_processes(void); | 56 | extern int freeze_processes(void); |
@@ -83,6 +68,12 @@ static inline int try_to_freeze(void) | |||
83 | extern bool freeze_task(struct task_struct *p, bool sig_only); | 68 | extern bool freeze_task(struct task_struct *p, bool sig_only); |
84 | extern void cancel_freezing(struct task_struct *p); | 69 | extern void cancel_freezing(struct task_struct *p); |
85 | 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 | |||
86 | /* | 77 | /* |
87 | * 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 |
88 | * 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 |