1 ============== 2 Cgroup Freezer 3 ============== 4 5 The cgroup freezer is useful to batch job mana 6 and stop sets of tasks in order to schedule th 7 according to the desires of a system administr 8 is often used on HPC clusters to schedule acce 9 whole. The cgroup freezer uses cgroups to desc 10 be started/stopped by the batch job management 11 a means to start and stop the tasks composing 12 13 The cgroup freezer will also be useful for che 14 of tasks. The freezer allows the checkpoint co 15 image of the tasks by attempting to force the 16 quiescent state. Once the tasks are quiescent 17 walk /proc or invoke a kernel interface to gat 18 quiesced tasks. Checkpointed tasks can be rest 19 recoverable error occur. This also allows the 20 migrated between nodes in a cluster by copying 21 to another node and restarting the tasks there 22 23 Sequences of SIGSTOP and SIGCONT are not alway 24 and resuming tasks in userspace. Both of these 25 from within the tasks we wish to freeze. While 26 blocked, or ignored it can be seen by waiting 27 SIGCONT is especially unsuitable since it can 28 programs designed to watch for SIGSTOP and SIG 29 attempting to use SIGSTOP and SIGCONT to stop 30 demonstrate this problem using nested bash she 31 32 $ echo $$ 33 16644 34 $ bash 35 $ echo $$ 36 16690 37 38 From a second, unrelated bash shell: 39 $ kill -SIGSTOP 16690 40 $ kill -SIGCONT 16690 41 42 <at this point 16690 exits and causes 43 44 This happens because bash can observe both sig 45 responds to them. 46 47 Another example of a program which catches and 48 signals is gdb. In fact any program designed t 49 have a problem with this method of stopping an 50 51 In contrast, the cgroup freezer uses the kerne 52 prevent the freeze/unfreeze cycle from becomin 53 being frozen. This allows the bash example abo 54 expected. 55 56 The cgroup freezer is hierarchical. Freezing a 57 tasks belonging to the cgroup and all its desc 58 cgroup has its own state (self-state) and the 59 parent (parent-state). Iff both states are THA 60 THAWED. 61 62 The following cgroupfs files are created by cg 63 64 * freezer.state: Read-write. 65 66 When read, returns the effective state of th 67 "FREEZING" or "FROZEN". This is the combined 68 If any is freezing, the cgroup is freezing ( 69 70 FREEZING cgroup transitions into FROZEN stat 71 belonging to the cgroup and its descendants 72 a cgroup reverts to FREEZING from FROZEN aft 73 to the cgroup or one of its descendant cgrou 74 frozen. 75 76 When written, sets the self-state of the cgr 77 allowed - "FROZEN" and "THAWED". If FROZEN i 78 if not already freezing, enters FREEZING sta 79 descendant cgroups. 80 81 If THAWED is written, the self-state of the 82 THAWED. Note that the effective state may n 83 the parent-state is still freezing. If a cgr 84 becomes THAWED, all its descendants which ar 85 the cgroup also leave the freezing state. 86 87 * freezer.self_freezing: Read only. 88 89 Shows the self-state. 0 if the self-state is 90 This value is 1 iff the last write to freeze 91 92 * freezer.parent_freezing: Read only. 93 94 Shows the parent-state. 0 if none of the cg 95 frozen; otherwise, 1. 96 97 The root cgroup is non-freezable and the above 98 exist. 99 100 * Examples of usage:: 101 102 # mkdir /sys/fs/cgroup/freezer 103 # mount -t cgroup -ofreezer freezer /sys/fs 104 # mkdir /sys/fs/cgroup/freezer/0 105 # echo $some_pid > /sys/fs/cgroup/freezer/0 106 107 to get status of the freezer subsystem:: 108 109 # cat /sys/fs/cgroup/freezer/0/freezer.stat 110 THAWED 111 112 to freeze all tasks in the container:: 113 114 # echo FROZEN > /sys/fs/cgroup/freezer/0/fr 115 # cat /sys/fs/cgroup/freezer/0/freezer.stat 116 FREEZING 117 # cat /sys/fs/cgroup/freezer/0/freezer.stat 118 FROZEN 119 120 to unfreeze all tasks in the container:: 121 122 # echo THAWED > /sys/fs/cgroup/freezer/0/fr 123 # cat /sys/fs/cgroup/freezer/0/freezer.stat 124 THAWED 125 126 This is the basic mechanism which should do th 127 in a simple scenario.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.