Open2

Burstable CFS Bandwidth Controller

TenForwardTenForward

5.14 kernel も参照

制限なし

# for f in $(ls cpu.cfs*); do echo $f; cat $f; done
cpu.cfs_burst_us
0
cpu.cfs_period_us
100000
cpu.cfs_quota_us
-1

CPU負荷 10%(--cpuload=10)、ジョブ数 5(--nubjobs=5)で設定しているので CPU を 10%*5 ほど使用している。

# fio --name=test --ioengine=cpuio --time_based=1 --runtime=60 --cpuload=10 --cpuchunks=100000 --numjobs=5 2>&1 | grep cpu
  : (snip)
  cpu          : usr=10.00%, sys=0.00%, ctx=63, majf=0, minf=6
  cpu          : usr=10.00%, sys=0.00%, ctx=71, majf=0, minf=7
  cpu          : usr=9.99%, sys=0.00%, ctx=84, majf=0, minf=7
  cpu          : usr=9.99%, sys=0.00%, ctx=63, majf=0, minf=7
  cpu          : usr=9.99%, sys=0.00%, ctx=78, majf=0, minf=7

CPU Quota を 2CPU に設定

root@discovery:/sys/fs/cgroup/cpu/test1# echo 200000 > cpu.cfs_quota_us 
root@discovery:/sys/fs/cgroup/cpu/test1# for f in $(ls cpu.cfs*); do echo $f; cat $f; done
cpu.cfs_burst_us
0
cpu.cfs_period_us
100000
cpu.cfs_quota_us
200000
root@discovery:/sys/fs/cgroup/cpu/test1# fio --name=test --ioengine=cpuio --time_based=1 --runtime=60 --cpuload=10 --cpuchunks=100000 --numjobs=5 2>&1 | grep cpu
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
  cpu          : usr=4.46%, sys=0.00%, ctx=124, majf=0, minf=6
  cpu          : usr=4.50%, sys=0.00%, ctx=143, majf=0, minf=7
  cpu          : usr=4.46%, sys=0.00%, ctx=327, majf=0, minf=7
  cpu          : usr=4.50%, sys=0.00%, ctx=128, majf=0, minf=6
  cpu          : usr=4.53%, sys=0.00%, ctx=121, majf=0, minf=6

CPU Burst で +1CPU(=100000) 設定


root@discovery:/sys/fs/cgroup/cpu/test1# echo 100000 > cpu.cfs_burst_us
root@discovery:/sys/fs/cgroup/cpu/test1# for f in $(ls cpu.cfs*); do echo $f; cat $f; done
cpu.cfs_burst_us
100000
cpu.cfs_period_us
100000
cpu.cfs_quota_us
200000
root@discovery:/sys/fs/cgroup/cpu/test1# fio --name=test --ioengine=cpuio --time_based=1 --runtime=60 --cpuload=10 --cpuchunks=100000 --numjobs=5
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
test: ioengine=cpuio, cpuload=10, cpucycle=100000
  cpu          : usr=9.99%, sys=0.00%, ctx=62, majf=0, minf=6
  cpu          : usr=9.48%, sys=0.00%, ctx=104, majf=0, minf=7
  cpu          : usr=9.99%, sys=0.00%, ctx=77, majf=0, minf=7
  cpu          : usr=9.99%, sys=0.00%, ctx=64, majf=0, minf=6
  cpu          : usr=9.99%, sys=0.00%, ctx=368, majf=0, minf=6