diff options
author | Matt Helsley <matthltc@us.ibm.com> | 2008-10-18 23:27:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:52:34 -0400 |
commit | dc52ddc0e6f45b04780b26fc0813509f8e798c42 (patch) | |
tree | 384826e9fab4e434bc5c85ce744470ae472e52c3 /arch | |
parent | 8174f1503f4bf7e9a14b3fbbfdb30c6be6e29f77 (diff) |
container freezer: implement freezer cgroup subsystem
This patch implements a new freezer subsystem in the control groups
framework. It provides a way to stop and resume execution of all tasks in
a cgroup by writing in the cgroup filesystem.
The freezer subsystem in the container filesystem defines a file named
freezer.state. Writing "FROZEN" to the state file will freeze all tasks
in the cgroup. Subsequently writing "RUNNING" will unfreeze the tasks in
the cgroup. Reading will return the current state.
* 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 is the basic mechanism which should do the right thing for user space
task in a simple scenario.
It's important to note that freezing can be incomplete. In that case we
return EBUSY. This means that some tasks in the cgroup are busy doing
something that prevents us from completely freezing the cgroup at this
time. After EBUSY, the cgroup will remain partially frozen -- reflected
by freezer.state reporting "FREEZING" when read. The state will remain
"FREEZING" until one of these things happens:
1) Userspace cancels the freezing operation by writing "RUNNING" to
the freezer.state file
2) Userspace retries the freezing operation by writing "FROZEN" to
the freezer.state file (writing "FREEZING" is not legal
and returns EIO)
3) The tasks that blocked the cgroup from entering the "FROZEN"
state disappear from the cgroup's set of tasks.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: export thaw_process]
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/Kconfig | 2 | ||||
-rw-r--r-- | arch/avr32/Kconfig | 2 | ||||
-rw-r--r-- | arch/blackfin/Kconfig | 3 | ||||
-rw-r--r-- | arch/cris/Kconfig | 2 | ||||
-rw-r--r-- | arch/frv/Kconfig | 2 | ||||
-rw-r--r-- | arch/h8300/Kconfig | 2 | ||||
-rw-r--r-- | arch/ia64/Kconfig | 2 | ||||
-rw-r--r-- | arch/m32r/Kconfig | 2 | ||||
-rw-r--r-- | arch/m68k/Kconfig | 2 | ||||
-rw-r--r-- | arch/m68knommu/Kconfig | 2 | ||||
-rw-r--r-- | arch/mips/Kconfig | 2 | ||||
-rw-r--r-- | arch/mn10300/Kconfig | 2 | ||||
-rw-r--r-- | arch/parisc/Kconfig | 2 | ||||
-rw-r--r-- | arch/powerpc/Kconfig | 2 | ||||
-rw-r--r-- | arch/s390/Kconfig | 2 | ||||
-rw-r--r-- | arch/sh/Kconfig | 2 | ||||
-rw-r--r-- | arch/sparc/Kconfig | 2 | ||||
-rw-r--r-- | arch/sparc64/Kconfig | 1 | ||||
-rw-r--r-- | arch/um/Kconfig | 2 | ||||
-rw-r--r-- | arch/x86/Kconfig | 1 | ||||
-rw-r--r-- | arch/xtensa/Kconfig | 1 |
22 files changed, 41 insertions, 0 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index a0f642b6a4b9..6110197757a3 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -70,6 +70,7 @@ config AUTO_IRQ_AFFINITY | |||
70 | default y | 70 | default y |
71 | 71 | ||
72 | source "init/Kconfig" | 72 | source "init/Kconfig" |
73 | source "kernel/Kconfig.freezer" | ||
73 | 74 | ||
74 | 75 | ||
75 | menu "System setup" | 76 | menu "System setup" |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 4853f9df37bd..df39d20f7425 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -192,6 +192,8 @@ config VECTORS_BASE | |||
192 | 192 | ||
193 | source "init/Kconfig" | 193 | source "init/Kconfig" |
194 | 194 | ||
195 | source "kernel/Kconfig.freezer" | ||
196 | |||
195 | menu "System Type" | 197 | menu "System Type" |
196 | 198 | ||
197 | choice | 199 | choice |
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig index 7c239a916275..33a5b2969eb4 100644 --- a/arch/avr32/Kconfig +++ b/arch/avr32/Kconfig | |||
@@ -72,6 +72,8 @@ config GENERIC_BUG | |||
72 | 72 | ||
73 | source "init/Kconfig" | 73 | source "init/Kconfig" |
74 | 74 | ||
75 | source "kernel/Kconfig.freezer" | ||
76 | |||
75 | menu "System Type and features" | 77 | menu "System Type and features" |
76 | 78 | ||
77 | source "kernel/time/Kconfig" | 79 | source "kernel/time/Kconfig" |
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig index 8102c79aaa94..29e71ed6b8a7 100644 --- a/arch/blackfin/Kconfig +++ b/arch/blackfin/Kconfig | |||
@@ -64,8 +64,11 @@ config HARDWARE_PM | |||
64 | depends on OPROFILE | 64 | depends on OPROFILE |
65 | 65 | ||
66 | source "init/Kconfig" | 66 | source "init/Kconfig" |
67 | |||
67 | source "kernel/Kconfig.preempt" | 68 | source "kernel/Kconfig.preempt" |
68 | 69 | ||
70 | source "kernel/Kconfig.freezer" | ||
71 | |||
69 | menu "Blackfin Processor Options" | 72 | menu "Blackfin Processor Options" |
70 | 73 | ||
71 | comment "Processor and Board Settings" | 74 | comment "Processor and Board Settings" |
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 9389d38f222f..07335e719bf8 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig | |||
@@ -62,6 +62,8 @@ config HZ | |||
62 | 62 | ||
63 | source "init/Kconfig" | 63 | source "init/Kconfig" |
64 | 64 | ||
65 | source "kernel/Kconfig.freezer" | ||
66 | |||
65 | menu "General setup" | 67 | menu "General setup" |
66 | 68 | ||
67 | source "fs/Kconfig.binfmt" | 69 | source "fs/Kconfig.binfmt" |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index a5aac1b07562..9d1552a9ee2c 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -66,6 +66,8 @@ mainmenu "Fujitsu FR-V Kernel Configuration" | |||
66 | 66 | ||
67 | source "init/Kconfig" | 67 | source "init/Kconfig" |
68 | 68 | ||
69 | source "kernel/Kconfig.freezer" | ||
70 | |||
69 | 71 | ||
70 | menu "Fujitsu FR-V system setup" | 72 | menu "Fujitsu FR-V system setup" |
71 | 73 | ||
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig index c7966746fbfe..bd1995403c67 100644 --- a/arch/h8300/Kconfig +++ b/arch/h8300/Kconfig | |||
@@ -90,6 +90,8 @@ config HZ | |||
90 | 90 | ||
91 | source "init/Kconfig" | 91 | source "init/Kconfig" |
92 | 92 | ||
93 | source "kernel/Kconfig.freezer" | ||
94 | |||
93 | source "arch/h8300/Kconfig.cpu" | 95 | source "arch/h8300/Kconfig.cpu" |
94 | 96 | ||
95 | menu "Executable file formats" | 97 | menu "Executable file formats" |
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig index 3b7aa38254a8..912c57db2d21 100644 --- a/arch/ia64/Kconfig +++ b/arch/ia64/Kconfig | |||
@@ -7,6 +7,8 @@ mainmenu "IA-64 Linux Kernel Configuration" | |||
7 | 7 | ||
8 | source "init/Kconfig" | 8 | source "init/Kconfig" |
9 | 9 | ||
10 | source "kernel/Kconfig.freezer" | ||
11 | |||
10 | menu "Processor type and features" | 12 | menu "Processor type and features" |
11 | 13 | ||
12 | config IA64 | 14 | config IA64 |
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig index 00289c178f89..dbaed4a63815 100644 --- a/arch/m32r/Kconfig +++ b/arch/m32r/Kconfig | |||
@@ -42,6 +42,8 @@ config HZ | |||
42 | 42 | ||
43 | source "init/Kconfig" | 43 | source "init/Kconfig" |
44 | 44 | ||
45 | source "kernel/Kconfig.freezer" | ||
46 | |||
45 | 47 | ||
46 | menu "Processor type and features" | 48 | menu "Processor type and features" |
47 | 49 | ||
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 677c93a490f6..836fb66f080d 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig | |||
@@ -62,6 +62,8 @@ mainmenu "Linux/68k Kernel Configuration" | |||
62 | 62 | ||
63 | source "init/Kconfig" | 63 | source "init/Kconfig" |
64 | 64 | ||
65 | source "kernel/Kconfig.freezer" | ||
66 | |||
65 | menu "Platform dependent setup" | 67 | menu "Platform dependent setup" |
66 | 68 | ||
67 | config EISA | 69 | config EISA |
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig index 0a8998315e5e..76b66feb74df 100644 --- a/arch/m68knommu/Kconfig +++ b/arch/m68knommu/Kconfig | |||
@@ -75,6 +75,8 @@ config NO_IOPORT | |||
75 | 75 | ||
76 | source "init/Kconfig" | 76 | source "init/Kconfig" |
77 | 77 | ||
78 | source "kernel/Kconfig.freezer" | ||
79 | |||
78 | menu "Processor type and features" | 80 | menu "Processor type and features" |
79 | 81 | ||
80 | choice | 82 | choice |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index b905744d7915..5f149b030c0f 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -1885,6 +1885,8 @@ config PROBE_INITRD_HEADER | |||
1885 | add initrd or initramfs image to the kernel image. | 1885 | add initrd or initramfs image to the kernel image. |
1886 | Otherwise, say N. | 1886 | Otherwise, say N. |
1887 | 1887 | ||
1888 | source "kernel/Kconfig.freezer" | ||
1889 | |||
1888 | menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" | 1890 | menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" |
1889 | 1891 | ||
1890 | config HW_HAS_EISA | 1892 | config HW_HAS_EISA |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index dd557c9cf001..9a9f43358879 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -68,6 +68,8 @@ mainmenu "Matsushita MN10300/AM33 Kernel Configuration" | |||
68 | 68 | ||
69 | source "init/Kconfig" | 69 | source "init/Kconfig" |
70 | 70 | ||
71 | source "kernel/Kconfig.freezer" | ||
72 | |||
71 | 73 | ||
72 | menu "Matsushita MN10300 system setup" | 74 | menu "Matsushita MN10300 system setup" |
73 | 75 | ||
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig index 8313fccced5e..2bd1f6ef5db0 100644 --- a/arch/parisc/Kconfig +++ b/arch/parisc/Kconfig | |||
@@ -90,6 +90,8 @@ config ARCH_MAY_HAVE_PC_FDC | |||
90 | 90 | ||
91 | source "init/Kconfig" | 91 | source "init/Kconfig" |
92 | 92 | ||
93 | source "kernel/Kconfig.freezer" | ||
94 | |||
93 | 95 | ||
94 | menu "Processor type and features" | 96 | menu "Processor type and features" |
95 | 97 | ||
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 380baa1780e9..9391199d9e77 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
@@ -230,6 +230,8 @@ config PPC_OF_PLATFORM_PCI | |||
230 | 230 | ||
231 | source "init/Kconfig" | 231 | source "init/Kconfig" |
232 | 232 | ||
233 | source "kernel/Kconfig.freezer" | ||
234 | |||
233 | source "arch/powerpc/sysdev/Kconfig" | 235 | source "arch/powerpc/sysdev/Kconfig" |
234 | source "arch/powerpc/platforms/Kconfig" | 236 | source "arch/powerpc/platforms/Kconfig" |
235 | 237 | ||
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index bc581d8a7cd9..70b7645ce745 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -78,6 +78,8 @@ config S390 | |||
78 | 78 | ||
79 | source "init/Kconfig" | 79 | source "init/Kconfig" |
80 | 80 | ||
81 | source "kernel/Kconfig.freezer" | ||
82 | |||
81 | menu "Base setup" | 83 | menu "Base setup" |
82 | 84 | ||
83 | comment "Processor type and features" | 85 | comment "Processor type and features" |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 5131d50f851a..2ed5713b7540 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -106,6 +106,8 @@ config IO_TRAPPED | |||
106 | 106 | ||
107 | source "init/Kconfig" | 107 | source "init/Kconfig" |
108 | 108 | ||
109 | source "kernel/Kconfig.freezer" | ||
110 | |||
109 | menu "System type" | 111 | menu "System type" |
110 | 112 | ||
111 | # | 113 | # |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 97671dac12a6..e594559c8dba 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -37,6 +37,8 @@ config HZ | |||
37 | 37 | ||
38 | source "init/Kconfig" | 38 | source "init/Kconfig" |
39 | 39 | ||
40 | source "kernel/Kconfig.freezer" | ||
41 | |||
40 | menu "General machine setup" | 42 | menu "General machine setup" |
41 | 43 | ||
42 | config SMP | 44 | config SMP |
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig index 5446e2a499b1..035b15af90d8 100644 --- a/arch/sparc64/Kconfig +++ b/arch/sparc64/Kconfig | |||
@@ -96,6 +96,7 @@ config GENERIC_HARDIRQS_NO__DO_IRQ | |||
96 | def_bool y | 96 | def_bool y |
97 | 97 | ||
98 | source "init/Kconfig" | 98 | source "init/Kconfig" |
99 | source "kernel/Kconfig.freezer" | ||
99 | 100 | ||
100 | menu "Processor type and features" | 101 | menu "Processor type and features" |
101 | 102 | ||
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index 6976812cfb18..393bccfe1785 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -229,6 +229,8 @@ endmenu | |||
229 | 229 | ||
230 | source "init/Kconfig" | 230 | source "init/Kconfig" |
231 | 231 | ||
232 | source "kernel/Kconfig.freezer" | ||
233 | |||
232 | source "drivers/block/Kconfig" | 234 | source "drivers/block/Kconfig" |
233 | 235 | ||
234 | source "arch/um/Kconfig.char" | 236 | source "arch/um/Kconfig.char" |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index bd3c2c53873e..49349ba77d80 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -193,6 +193,7 @@ config X86_TRAMPOLINE | |||
193 | config KTIME_SCALAR | 193 | config KTIME_SCALAR |
194 | def_bool X86_32 | 194 | def_bool X86_32 |
195 | source "init/Kconfig" | 195 | source "init/Kconfig" |
196 | source "kernel/Kconfig.freezer" | ||
196 | 197 | ||
197 | menu "Processor type and features" | 198 | menu "Processor type and features" |
198 | 199 | ||
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 02e417d3d8e9..a213260b51e5 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -55,6 +55,7 @@ config HZ | |||
55 | default 100 | 55 | default 100 |
56 | 56 | ||
57 | source "init/Kconfig" | 57 | source "init/Kconfig" |
58 | source "kernel/Kconfig.freezer" | ||
58 | 59 | ||
59 | menu "Processor type and features" | 60 | menu "Processor type and features" |
60 | 61 | ||