Merge pull request #813 from rajasec/update-kmem-tcp
Adding kernel mem tcp for update command
This commit is contained in:
commit
9bc97e2291
|
@ -13,7 +13,8 @@ accepted format is as follow (unchanged values can be omitted):
|
|||
"limit": 0,
|
||||
"reservation": 0,
|
||||
"swap": 0,
|
||||
"kernel": 0
|
||||
"kernel": 0,
|
||||
"kernelTCP": 0
|
||||
},
|
||||
"cpu": {
|
||||
"shares": 0,
|
||||
|
@ -38,7 +39,8 @@ other options are ignored.
|
|||
--cpu-share CPU shares (relative weight vs. other containers)
|
||||
--cpuset-cpus CPU(s) to use
|
||||
--cpuset-mems Memory node(s) to use
|
||||
--kernel-memory Kernel memory limit (in bytes) for tcp buffer
|
||||
--kernel-memory Kernel memory limit (in bytes)
|
||||
--kernel-memory-tcp Kernel memory limit (in bytes) for tcp buffer
|
||||
--memory Memory limit (in bytes)
|
||||
--memory-reservation Memory reservation or soft_limit (in bytes)
|
||||
--memory-swap Total memory usage (memory + swap); set `-1` to enable unlimited swap
|
||||
|
|
|
@ -34,7 +34,8 @@ function setup() {
|
|||
"memory": {
|
||||
"limit": 33554432,
|
||||
"reservation": 25165824,
|
||||
"kernel": 16777216
|
||||
"kernel": 16777216,
|
||||
"kernelTCP": 11534336
|
||||
},
|
||||
"cpu": {
|
||||
"shares": 100,
|
||||
|
@ -75,6 +76,7 @@ function check_cgroup_value() {
|
|||
check_cgroup_value $CGROUP_CPU "cpu.shares" 100
|
||||
check_cgroup_value $CGROUP_CPUSET "cpuset.cpus" 0
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 16777216
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 11534336
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.limit_in_bytes" 33554432
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.soft_limit_in_bytes" 25165824
|
||||
|
||||
|
@ -128,13 +130,19 @@ function check_cgroup_value() {
|
|||
[ "$status" -eq 0 ]
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 50331648
|
||||
|
||||
# update kernel memory tcp limit
|
||||
run "$RUNC" --root $UPDATE_TEST_RUNC_ROOT update test_update --kernel-memory-tcp 41943040
|
||||
[ "$status" -eq 0 ]
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 41943040
|
||||
|
||||
# Revert to the test initial value via json on stding
|
||||
run "$RUNC" --root $UPDATE_TEST_RUNC_ROOT update -r - test_update <<EOF
|
||||
{
|
||||
"memory": {
|
||||
"limit": 33554432,
|
||||
"reservation": 25165824,
|
||||
"kernel": 16777216
|
||||
"kernel": 16777216,
|
||||
"kernelTCP": 11534336
|
||||
},
|
||||
"cpu": {
|
||||
"shares": 100,
|
||||
|
@ -154,19 +162,21 @@ EOF
|
|||
check_cgroup_value $CGROUP_CPU "cpu.shares" 100
|
||||
check_cgroup_value $CGROUP_CPUSET "cpuset.cpus" 0
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 16777216
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 11534336
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.limit_in_bytes" 33554432
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.soft_limit_in_bytes" 25165824
|
||||
|
||||
# redo all the changes at once
|
||||
run "$RUNC" --root $UPDATE_TEST_RUNC_ROOT update test_update --blkio-weight 500 \
|
||||
--cpu-period 900000 --cpu-quota 600000 --cpu-share 200 --memory 67108864 \
|
||||
--memory-reservation 33554432 --kernel-memory 50331648
|
||||
--memory-reservation 33554432 --kernel-memory 50331648 --kernel-memory-tcp 41943040
|
||||
[ "$status" -eq 0 ]
|
||||
check_cgroup_value $CGROUP_BLKIO "blkio.weight" 500
|
||||
check_cgroup_value $CGROUP_CPU "cpu.cfs_period_us" 900000
|
||||
check_cgroup_value $CGROUP_CPU "cpu.cfs_quota_us" 600000
|
||||
check_cgroup_value $CGROUP_CPU "cpu.shares" 200
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 50331648
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 41943040
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.limit_in_bytes" 67108864
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.soft_limit_in_bytes" 33554432
|
||||
|
||||
|
@ -176,7 +186,8 @@ EOF
|
|||
"memory": {
|
||||
"limit": 33554432,
|
||||
"reservation": 25165824,
|
||||
"kernel": 16777216
|
||||
"kernel": 16777216,
|
||||
"kernelTCP": 11534336
|
||||
},
|
||||
"cpu": {
|
||||
"shares": 100,
|
||||
|
@ -200,6 +211,7 @@ EOF
|
|||
check_cgroup_value $CGROUP_CPU "cpu.shares" 100
|
||||
check_cgroup_value $CGROUP_CPUSET "cpuset.cpus" 0
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.limit_in_bytes" 16777216
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.kmem.tcp.limit_in_bytes" 11534336
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.limit_in_bytes" 33554432
|
||||
check_cgroup_value $CGROUP_MEMORY "memory.soft_limit_in_bytes" 25165824
|
||||
}
|
||||
|
|
|
@ -77,6 +77,10 @@ other options are ignored.
|
|||
},
|
||||
cli.StringFlag{
|
||||
Name: "kernel-memory",
|
||||
Usage: "Kernel memory limit (in bytes)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "kernel-memory-tcp",
|
||||
Usage: "Kernel memory limit (in bytes) for tcp buffer",
|
||||
},
|
||||
cli.StringFlag{
|
||||
|
@ -104,6 +108,7 @@ other options are ignored.
|
|||
Reservation: u64Ptr(0),
|
||||
Swap: u64Ptr(0),
|
||||
Kernel: u64Ptr(0),
|
||||
KernelTCP: u64Ptr(0),
|
||||
},
|
||||
CPU: &specs.CPU{
|
||||
Shares: u64Ptr(0),
|
||||
|
@ -153,6 +158,7 @@ other options are ignored.
|
|||
"cpu-quota": r.CPU.Quota,
|
||||
"cpu-share": r.CPU.Shares,
|
||||
"kernel-memory": r.Memory.Kernel,
|
||||
"kernel-memory-tcp": r.Memory.KernelTCP,
|
||||
"memory": r.Memory.Limit,
|
||||
"memory-reservation": r.Memory.Reservation,
|
||||
"memory-swap": r.Memory.Swap,
|
||||
|
@ -175,6 +181,7 @@ other options are ignored.
|
|||
config.Cgroups.Resources.CpusetCpus = *r.CPU.Cpus
|
||||
config.Cgroups.Resources.CpusetMems = *r.CPU.Mems
|
||||
config.Cgroups.Resources.KernelMemory = int64(*r.Memory.Kernel)
|
||||
config.Cgroups.Resources.KernelMemoryTCP = int64(*r.Memory.KernelTCP)
|
||||
config.Cgroups.Resources.Memory = int64(*r.Memory.Limit)
|
||||
config.Cgroups.Resources.MemoryReservation = int64(*r.Memory.Reservation)
|
||||
config.Cgroups.Resources.MemorySwap = int64(*r.Memory.Swap)
|
||||
|
|
Loading…
Reference in New Issue