amazon-eks-ami icon indicating copy to clipboard operation
amazon-eks-ami copied to clipboard

Enable Linux PSI metrics

Open jacknagel opened this issue 3 years ago • 1 comments

What would you like to be added: Enable kernel PSI metrics on EKS AMIs.

Why is this needed: We would like to collect PSI metrics using node-exporter. This feature is present, but not enabled, on the latest EKS AMI:

$ cat /proc/pressure/cpu
cat: /proc/pressure/cpu: Operation not supported
$ uname -a
Linux ip-10-210-10-154.ec2.internal 5.4.110-54.182.amzn2.x86_64 #1 SMP Fri Apr 9 17:56:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ cat /boot/config-`uname -r` | grep PSI
CONFIG_PSI=y
CONFIG_PSI_DEFAULT_DISABLED=y

jacknagel avatar May 03 '21 15:05 jacknagel

"CONFIG_PSI_DEFAULT_DISABLED=y" means not enabled by default.

see the code implementation in "kernel/sched/psi.c" file:

#ifdef CONFIG_PSI_DEFAULT_DISABLED
static bool psi_enable;
#else
static bool psi_enable = true;
#endif
static int __init setup_psi(char *str)
{
	return kstrtobool(str, &psi_enable) == 0;
}
__setup("psi=", setup_psi);

Before Linux 5.6 (like 5.4), the proc entries for psi will be created no matter the "psi_enable" varible is true or false, but these entries could not be read or written.

After merging this commit(https://github.com/torvalds/linux/commit/3d817689a62cf71bbb290af18cd26cf9764f38fe), the proc entries for psi will be created only when the "psi_enable" is true.

So for this case, you should add "psi=1" to the kernel command line to truly enable this feature, something like this:

grubby --args="psi=1" --update-kernel=/boot/vmlinuz-5.4.110-54.182.amzn2.x86_64

lanxinyuchs avatar Mar 15 '22 09:03 lanxinyuchs

+1, this would be super nice for monitoring tools, especially when combined with cgroupsv2

ellistarn avatar Dec 06 '22 17:12 ellistarn

@cartermckinnon Any update on if this can be enabled out of the box since we should be able to get something on the older kernel the AMI currently uses?

sidewinder12s avatar Jan 30 '23 23:01 sidewinder12s

No concerns from me, tested with 1.24 (on the 5.4 kernel) and seems fine. Opened #1161 .

cartermckinnon avatar Jan 31 '23 21:01 cartermckinnon