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>
This commit is contained in:
Matt Helsley
2008-10-18 20:27:19 -07:00
committed by Linus Torvalds
parent 83224b0837
commit 8174f1503f
5 changed files with 137 additions and 119 deletions

View File

@@ -6,7 +6,7 @@
#include <linux/sched.h>
#include <linux/wait.h>
#ifdef CONFIG_PM_SLEEP
#ifdef CONFIG_FREEZER
/*
* Check if a process has been frozen
*/
@@ -39,6 +39,11 @@ static inline void clear_freeze_flag(struct task_struct *p)
clear_tsk_thread_flag(p, TIF_FREEZE);
}
static inline bool should_send_signal(struct task_struct *p)
{
return !(p->flags & PF_FREEZER_NOSIG);
}
/*
* Wake up a frozen process
*
@@ -75,6 +80,9 @@ static inline int try_to_freeze(void)
return 0;
}
extern bool freeze_task(struct task_struct *p, bool sig_only);
extern void cancel_freezing(struct task_struct *p);
/*
* The PF_FREEZER_SKIP flag should be set by a vfork parent right before it
* 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)
} while (try_to_freeze()); \
__retval; \
})
#else /* !CONFIG_PM_SLEEP */
#else /* !CONFIG_FREEZER */
static inline int frozen(struct task_struct *p) { return 0; }
static inline int freezing(struct task_struct *p) { return 0; }
static inline void set_freeze_flag(struct task_struct *p) {}
@@ -191,6 +199,6 @@ static inline void set_freezable_with_signal(void) {}
#define wait_event_freezable_timeout(wq, condition, timeout) \
wait_event_interruptible_timeout(wq, condition, timeout)
#endif /* !CONFIG_PM_SLEEP */
#endif /* !CONFIG_FREEZER */
#endif /* FREEZER_H_INCLUDED */