aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/freezer.h
diff options
context:
space:
mode:
authorMatt Helsley <matthltc@us.ibm.com>2008-10-18 23:27:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-20 11:52:33 -0400
commit8174f1503f4bf7e9a14b3fbbfdb30c6be6e29f77 (patch)
treea8df1ebd62255dd231452b3f72782604e8919991 /include/linux/freezer.h
parent83224b08372be48d5fcefedc4886457da29130c8 (diff)
container freezer: make refrigerator always available
Now that the TIF_FREEZE flag is available in all architectures, extract the refrigerator() and freeze_task() from kernel/power/process.c and make it available to all. The refrigerator() can now be used in a control group subsystem implementing a control group freezer. Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Signed-off-by: Matt Helsley <matthltc@us.ibm.com> Acked-by: Serge E. Hallyn <serue@us.ibm.com> Tested-by: Matt Helsley <matthltc@us.ibm.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/freezer.h')
-rw-r--r--include/linux/freezer.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/include/linux/freezer.h b/include/linux/freezer.h
index deddeedf3257..17e3bb42dd3c 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,6 +39,11 @@ 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
42static 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 * 49 *
@@ -75,6 +80,9 @@ static inline int try_to_freeze(void)
75 return 0; 80 return 0;
76} 81}
77 82
83extern bool freeze_task(struct task_struct *p, bool sig_only);
84extern void cancel_freezing(struct task_struct *p);
85
78/* 86/*
79 * The PF_FREEZER_SKIP flag should be set by a vfork parent right before it 87 * 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 88 * calls wait_for_completion(&vfork) and reset right after it returns from this
@@ -166,7 +174,7 @@ static inline void set_freezable_with_signal(void)
166 } while (try_to_freeze()); \ 174 } while (try_to_freeze()); \
167 __retval; \ 175 __retval; \
168}) 176})
169#else /* !CONFIG_PM_SLEEP */ 177#else /* !CONFIG_FREEZER */
170static inline int frozen(struct task_struct *p) { return 0; } 178static inline int frozen(struct task_struct *p) { return 0; }
171static inline int freezing(struct task_struct *p) { return 0; } 179static inline int freezing(struct task_struct *p) { return 0; }
172static inline void set_freeze_flag(struct task_struct *p) {} 180static inline void set_freeze_flag(struct task_struct *p) {}
@@ -191,6 +199,6 @@ static inline void set_freezable_with_signal(void) {}
191#define wait_event_freezable_timeout(wq, condition, timeout) \ 199#define wait_event_freezable_timeout(wq, condition, timeout) \
192 wait_event_interruptible_timeout(wq, condition, timeout) 200 wait_event_interruptible_timeout(wq, condition, timeout)
193 201
194#endif /* !CONFIG_PM_SLEEP */ 202#endif /* !CONFIG_FREEZER */
195 203
196#endif /* FREEZER_H_INCLUDED */ 204#endif /* FREEZER_H_INCLUDED */