Linux 4.20 で導入の PSI 機能(1)

以前から Facebook のスライドなんかでは見かけた PSI という機能が 4.20 カーネルで入ったようですね。


Collect metrics that indicate how overcommitted the CPU, memory,
and IO capacity are in the system.

If you say Y here, the kernel will create /proc/pressure/ with the
pressure statistics files cpu, memory, and io. These will indicate
the share of walltime in which some or all tasks in the system are
delayed due to contention of the respective resource.

In kernels with cgroup support, cgroups (cgroup2 only) will
have cpu.pressure, memory.pressure, and io.pressure files,
which aggregate pressure stalls for the grouped tasks only.

For more details see Documentation/accounting/psi.txt.

これを有効にすれば良さそう。さっそく Y で 4.20 を make。/proc/pressure なんてディレクトリが現れて、そこにファイルが 3 つほど置かれていました。

$ uname -a
Linux discovery 4.20.0-plamo64 #2 SMP PREEMPT Mon Jan 7 16:31:47 JST 2019 x86_64 GNU/Linux
$ for f in $(ls /proc/pressure/); do echo "$f: "; cat /proc/pressure/$f; done
some avg10=0.00 avg60=0.00 avg300=0.00 total=60048550
some avg10=0.00 avg60=0.00 avg300=0.00 total=30250330
full avg10=0.00 avg60=0.00 avg300=0.00 total=28401529
some avg10=0.00 avg60=0.00 avg300=0.00 total=146509
full avg10=0.00 avg60=0.00 avg300=0.00 total=100482

cgroup2 をマウントすれば、cgroup にも同じようなファイルが現れるらしいがとりあえず今日はここまで(内容なさすぎ)。