Skip to content

Commit 83224b0

Browse files
Matt Helsleytorvalds
authored andcommitted
container freezer: add TIF_FREEZE flag to all architectures
This patch series introduces a cgroup subsystem that utilizes the swsusp freezer to freeze a group of tasks. It's immediately useful for batch job management scripts. It should also be useful in the future for implementing container checkpoint/restart. The freezer subsystem in the container filesystem defines a cgroup file named freezer.state. Reading freezer.state will return the current state of the cgroup. Writing "FROZEN" to the state file will freeze all tasks in the cgroup. Subsequently writing "RUNNING" will unfreeze the tasks in the cgroup. * Examples of usage : # mkdir /containers/freezer # mount -t cgroup -ofreezer freezer /containers # mkdir /containers/0 # echo $some_pid > /containers/0/tasks to get status of the freezer subsystem : # cat /containers/0/freezer.state RUNNING to freeze all tasks in the container : # echo FROZEN > /containers/0/freezer.state # cat /containers/0/freezer.state FREEZING # cat /containers/0/freezer.state FROZEN to unfreeze all tasks in the container : # echo RUNNING > /containers/0/freezer.state # cat /containers/0/freezer.state RUNNING This patch: The first step in making the refrigerator() available to all architectures, even for those without power management. The purpose of such a change is to be able to use the refrigerator() in a new control group subsystem which will implement a control group freezer. [akpm@linux-foundation.org: fix sparc] Signed-off-by: Cedric Le Goater <clg@fr.ibm.com> Signed-off-by: Matt Helsley <matthltc@us.ibm.com> Acked-by: Pavel Machek <pavel@suse.cz> Acked-by: Serge E. Hallyn <serue@us.ibm.com> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Nigel Cunningham <nigel@tuxonice.net> Tested-by: Matt Helsley <matthltc@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5e9a0f0 commit 83224b0

12 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎arch/alpha/include/asm/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ register struct thread_info *__current_thread_info __asm__("$8");
7474
#define TIF_UAC_SIGBUS 7
7575
#define TIF_MEMDIE 8
7676
#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal */
77+
#define TIF_FREEZE 16 /* is freezing for suspend */
7778

7879
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
7980
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
8081
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
8182
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
8283
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
84+
#define _TIF_FREEZE (1<<TIF_FREEZE)
8385

8486
/* Work to do on interrupt/exception return. */
8587
#define _TIF_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED)

‎arch/avr32/include/asm/thread_info.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static inline struct thread_info *current_thread_info(void)
9696
#define _TIF_MEMDIE (1 << TIF_MEMDIE)
9797
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
9898
#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
99+
#define _TIF_FREEZE (1 << TIF_FREEZE)
99100

100101
/* Note: The masks below must never span more than 16 bits! */
101102

‎arch/h8300/include/asm/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,15 @@ static inline struct thread_info *current_thread_info(void)
8989
TIF_NEED_RESCHED */
9090
#define TIF_MEMDIE 4
9191
#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */
92+
#define TIF_FREEZE 16 /* is freezing for suspend */
9293

9394
/* as above, but as bit values */
9495
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
9596
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
9697
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
9798
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
9899
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
100+
#define _TIF_FREEZE (1<<TIF_FREEZE)
99101

100102
#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
101103

‎arch/m68knommu/include/asm/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,14 @@ static inline struct thread_info *current_thread_info(void)
8484
#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
8585
TIF_NEED_RESCHED */
8686
#define TIF_MEMDIE 4
87+
#define TIF_FREEZE 16 /* is freezing for suspend */
8788

8889
/* as above, but as bit values */
8990
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
9091
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
9192
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
9293
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
94+
#define _TIF_FREEZE (1<<TIF_FREEZE)
9395

9496
#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
9597

‎arch/s390/include/asm/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static inline struct thread_info *current_thread_info(void)
9999
#define TIF_31BIT 18 /* 32bit process */
100100
#define TIF_MEMDIE 19
101101
#define TIF_RESTORE_SIGMASK 20 /* restore signal mask in do_signal() */
102+
#define TIF_FREEZE 21 /* thread is freezing for suspend */
102103

103104
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
104105
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -112,6 +113,7 @@ static inline struct thread_info *current_thread_info(void)
112113
#define _TIF_USEDFPU (1<<TIF_USEDFPU)
113114
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
114115
#define _TIF_31BIT (1<<TIF_31BIT)
116+
#define _TIF_FREEZE (1<<TIF_FREEZE)
115117

116118
#endif /* __KERNEL__ */
117119

‎arch/sparc/include/asm/thread_info_32.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
135135
#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
136136
* TIF_NEED_RESCHED */
137137
#define TIF_MEMDIE 10
138+
#define TIF_FREEZE 11 /* is freezing for suspend */
138139

139140
/* as above, but as bit values */
140141
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -148,6 +149,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
148149
#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
149150
_TIF_SIGPENDING | \
150151
_TIF_RESTORE_SIGMASK)
152+
#define _TIF_FREEZE (1<<TIF_FREEZE)
151153

152154
#endif /* __KERNEL__ */
153155

‎arch/sparc/include/asm/thread_info_64.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
237237
#define TIF_ABI_PENDING 12
238238
#define TIF_MEMDIE 13
239239
#define TIF_POLLING_NRFLAG 14
240+
#define TIF_FREEZE 15 /* is freezing for suspend */
240241

241242
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
242243
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
@@ -249,6 +250,7 @@ register struct thread_info *current_thread_info_reg asm("g6");
249250
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
250251
#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
251252
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
253+
#define _TIF_FREEZE (1<<TIF_FREEZE)
252254

253255
#define _TIF_USER_WORK_MASK ((0xff << TI_FLAG_WSAVED_SHIFT) | \
254256
_TIF_DO_NOTIFY_RESUME_MASK | \

‎include/asm-cris/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,15 @@ struct thread_info {
8888
#define TIF_RESTORE_SIGMASK 9 /* restore signal mask in do_signal() */
8989
#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */
9090
#define TIF_MEMDIE 17
91+
#define TIF_FREEZE 18 /* is freezing for suspend */
9192

9293
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
9394
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
9495
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
9596
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
9697
#define _TIF_RESTORE_SIGMASK (1<<TIF_RESTORE_SIGMASK)
9798
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
99+
#define _TIF_FREEZE (1<<TIF_FREEZE)
98100

99101
#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */
100102
#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */

‎include/asm-m68k/thread_info.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ struct thread_info {
5252
#define TIF_DELAYED_TRACE 14 /* single step a syscall */
5353
#define TIF_SYSCALL_TRACE 15 /* syscall trace active */
5454
#define TIF_MEMDIE 16
55+
#define TIF_FREEZE 17 /* thread is freezing for suspend */
5556

5657
#endif /* _ASM_M68K_THREAD_INFO_H */

‎include/asm-parisc/thread_info.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ struct thread_info {
5858
#define TIF_32BIT 4 /* 32 bit binary */
5959
#define TIF_MEMDIE 5
6060
#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
61+
#define TIF_FREEZE 7 /* is freezing for suspend */
6162

6263
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
6364
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
6465
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
6566
#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
6667
#define _TIF_32BIT (1 << TIF_32BIT)
6768
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
69+
#define _TIF_FREEZE (1 << TIF_FREEZE)
6870

6971
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | \
7072
_TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)

0 commit comments

Comments
 (0)