@@ -33,6 +33,9 @@ function setup() {
3333 "blockio": {
3434 "blkioWeight": 1000
3535 },
36+ "pids": {
37+ "limit": 20
38+ },
3639EOF
3740 )
3841 DATA=$( echo ${DATA} | sed ' s/\n/\\n/g' )
@@ -61,7 +64,7 @@ function check_cgroup_value() {
6164 wait_for_container 15 1 test_update
6265
6366 # get the cgroup paths
64- for g in MEMORY CPUSET CPU BLKIO; do
67+ for g in MEMORY CPUSET CPU BLKIO PIDS ; do
6568 base_path=$( grep " cgroup" /proc/self/mountinfo | gawk ' toupper($NF) ~ /\<' ${g} ' \>/ { print $5; exit }' )
6669 eval CGROUP_${g} =" ${base_path} /runc-update-integration-test"
6770 done
@@ -78,6 +81,7 @@ function check_cgroup_value() {
7881 check_cgroup_value $CGROUP_MEMORY " memory.kmem.tcp.limit_in_bytes" 11534336
7982 check_cgroup_value $CGROUP_MEMORY " memory.limit_in_bytes" 33554432
8083 check_cgroup_value $CGROUP_MEMORY " memory.soft_limit_in_bytes" 25165824
84+ check_cgroup_value $CGROUP_PIDS " pids.max" 20
8185
8286 # update blkio-weight
8387 runc update test_update --blkio-weight 500
@@ -160,6 +164,11 @@ function check_cgroup_value() {
160164 [ " $status " -eq 0 ]
161165 check_cgroup_value $CGROUP_MEMORY " memory.kmem.tcp.limit_in_bytes" 41943040
162166
167+ # update pids limit
168+ runc update test_update --pids-limit 10
169+ [ " $status " -eq 0 ]
170+ check_cgroup_value $CGROUP_PIDS " pids.max" 10
171+
163172 # Revert to the test initial value via json on stding
164173 runc update -r - test_update << EOF
165174{
@@ -177,6 +186,9 @@ function check_cgroup_value() {
177186 },
178187 "blockIO": {
179188 "blkioWeight": 1000
189+ },
190+ "pids": {
191+ "limit": 20
180192 }
181193}
182194EOF
@@ -190,11 +202,13 @@ EOF
190202 check_cgroup_value $CGROUP_MEMORY " memory.kmem.tcp.limit_in_bytes" 11534336
191203 check_cgroup_value $CGROUP_MEMORY " memory.limit_in_bytes" 33554432
192204 check_cgroup_value $CGROUP_MEMORY " memory.soft_limit_in_bytes" 25165824
205+ check_cgroup_value $CGROUP_PIDS " pids.max" 20
193206
194207 # redo all the changes at once
195208 runc update test_update --blkio-weight 500 \
196209 --cpu-period 900000 --cpu-quota 600000 --cpu-share 200 --memory 67108864 \
197- --memory-reservation 33554432 --kernel-memory 50331648 --kernel-memory-tcp 41943040
210+ --memory-reservation 33554432 --kernel-memory 50331648 --kernel-memory-tcp 41943040 \
211+ --pids-limit 10
198212 [ " $status " -eq 0 ]
199213 check_cgroup_value $CGROUP_BLKIO " blkio.weight" 500
200214 check_cgroup_value $CGROUP_CPU " cpu.cfs_period_us" 900000
204218 check_cgroup_value $CGROUP_MEMORY " memory.kmem.tcp.limit_in_bytes" 41943040
205219 check_cgroup_value $CGROUP_MEMORY " memory.limit_in_bytes" 67108864
206220 check_cgroup_value $CGROUP_MEMORY " memory.soft_limit_in_bytes" 33554432
221+ check_cgroup_value $CGROUP_PIDS " pids.max" 10
207222
208223 # reset to initial test value via json file
209224 DATA=$( cat << "EOF "
222237 },
223238 "blockIO": {
224239 "blkioWeight": 1000
240+ },
241+ "pids": {
242+ "limit": 20
225243 }
226244}
227245EOF
239257 check_cgroup_value $CGROUP_MEMORY " memory.kmem.tcp.limit_in_bytes" 11534336
240258 check_cgroup_value $CGROUP_MEMORY " memory.limit_in_bytes" 33554432
241259 check_cgroup_value $CGROUP_MEMORY " memory.soft_limit_in_bytes" 25165824
260+ check_cgroup_value $CGROUP_PIDS " pids.max" 20
242261}
243262
244263@test " update rt period and runtime" {
0 commit comments