-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve PSI support #25
Comments
added psi_excess_duration |
TODO:
->
|
|
A bug with the current PSI is that it solely relies on it to kill/terminate processes.
|
Now the main problem is the lack of documentation. |
What do you suggest instead? |
It's OK, it's by design. The daemon responds to low memory levels and to higher psi thresholds independently of each other. Nohang kills a process if PSI threshold exceeded, is's OK. |
I forgot to tell you that the PSI on the desktop is a very dangerous thing and it requires an individual approach and caution when setting up. |
See also rfjakob/earlyoom#100 (comment) |
Simple solution: increase PSI thresholds and psi_excess_duration, or disable psi checking completely. |
This should explain everything: it causes long-term memory pressure, thresholds are exceeded, and the demon killed a process. Not a bug, just non-optimal settings. Probably after this precedent, I should offer higher default thresholds for psi, and add warnings in docs. |
@dim-geo Could you show me you |
Hi, The solution that I propose is that when PSI monitoring is activated, please check also that there is a lack of memory before killing. If no lack of free swap/memory, ignore the high PSI usage. I will post the mounts and cgroup later. |
I don't think that this affects the correct operation of PSI.
Bad idea. PSI may be HIGH and system may be frozen at HIGH SwapFree. These are two independent metrics: MemAvailable & SwapFree may be at low level and PSI may be about 0. The reverse is also possible: SwapFree=60% and PSI=90. You may try https://github.com/hakavlad/nohang-extra/blob/master/trash/psi-trigger (SwapFree will be about 50% and PSI values will be high) |
Hi,
cat /proc/self/cgroup
For the time being I deactivated psi. |
@dim-geo Thank you for the report! How did you disable cgroup_v1? Did you add |
@dim-geo Do you use SSD or HDD? Do you use zswap or zram? |
I have both SSD and HDDs. I use zram.
|
Do you use also btrfs? See https://bugzilla.kernel.org/show_bug.cgi?id=196729
|
Yes, I do. I disabled PSI from kernel for the time being because it increases sometimes kworker process. Something there is fishy, I will wait for the next kernels to retest it... |
@hakavlad MuQSS may still contribute to the problem @dim-geo experiences. It apparently supports some cgroup features but not all(I'm not sure which ones), and Facebooks PSI utilizes cgroups afaik? It'd be better to confirm with a different kernel that has proper cgroups support. EDIT: The cgroup support with PSI is optional, but it might still be using it if the MuQSS kernel advertises it as available, even if not fully supported by MuQSS, thus if PSI attempts to use it, it may not work as expected when it attempts to utilize cgroups that MuQSS lacks proper support for. |
Also, Facebook uses PSI with their The linked bug report has nothing to do with PSI or cgroups, let alone the age of the report is with the 4.10 kernel(PSI afaik requires 4.20 minimum?). BTRFS itself has also had significant improvements/fixes since 4.10, including getting support for swap files. I can see how XFS may improve things and be more stable than BTRFS, but that does not rule out MuQSS as the cause, especially since @dim-geo has not verified changing filesystems resolves the issue. Comment 54 on the bug report also points out the issue is unrelated to BTRFS, citing changes with 4.19 kernel patch versions as well as 5.2/5.3 kernels. While BTRFS may be a contributing factor in that report, it also seems to potentially be due to a combination of other parts of the system. Other users chime in on that report with similar problems without using BTRFS. |
New nohang behavior with Demo: https://youtu.be/Y6GJqFE_ke4. Commands:
with such config keys:
MemTotal=9.6GiB, zram disksize=47.8GiB. Now PSI response enabled by default in |
It's relatively unlikely that PSI works correctly with an out of tree scheduler. |
@danobi Thanks! |
Both MuQSS and BMQ task schedulers stub cgroups support(that they're responsible for afaik), which has been known to cause issues with things like CPU accounting metrics being unreliable. As stated earlier, they're the most likely cause of the issue, and PSI without explicitly disabling the cgroup support is probably trying to use those stubbed out cgroup features, thus itself not working reliably. These schedulers are known to not play well with other software that also utilizes cgroups for CPU activity. |
@polarathene Thanks! |
Linux-ck with MuQSS provides incorrect PSI metrics: https://imgur.com/a/atIjhUw. CPU metrics is always about 100%. After stress test: some memory is always about 100%. Full io is always about 0. |
@hakavlad ? I thought I had stated that was the likely cause, since MuQSS and BMQ only provide cgroup stubs for CPU features that PSI utilizes? Unless you explicitly disable PSI from using cgroups, I'm not sure if you can do that by specifically for PSI alone, or if you have to disable cgroups completely:
Doing so would possibly cause problems/regressions for anything else that expects cgroup support(reliable or not), and afaik it's only a portion related to CPUs that is stubbed by those task schedulers, while other cgroup support works as expected such as for block I/O schedulers like BFQ that utilize different cgroups features. If someone looks into it further, and can selectively disable it for PSI alone, and that results in better metrics(for kernels using these task schedulers), let me know :) |
linux-ck with MuQSShttps://wiki.archlinux.org/index.php/Linux-ck
Screenshots: |
Ah cool. It's effectively same as not including PSI support in the kernel though right? In my previous post I linked to the PSI cgroup2 interface docs, which do not mention a way for telling PSI not to use cgroups(it will use them if the kernel enabled cgroups via Just to confirm, your tests are with boot parameter |
Of course, psi is enabled by passing psi=1. I don't know how to disable cgroup_v2 support. |
linux-lqx with MuQSShttps://aur.archlinux.org/packages/linux-lqx/
PSI cannot be enabled. 5.6.0-18.1-liquorix-amd64 on Ubuntu 20.04
PSI cannot be enabled by passing psi=1. |
linux-pf with BMQhttps://aur.archlinux.org/packages/linux-pf/
No problem, PSI works fine out of the box. |
linux-gc with BMQhttps://aur.archlinux.org/packages/linux-gc/
No problem with PSI out of the box. |
XanMod Kernel on Ubuntu 20.04
PSI works well out of the box with CONFIG_SCHED_MUQSS=y. |
@polarathene So, I saw kernels that provides correct PSI metrics with MuQSS (XanMod kernel) and with BMQ (linux-gc, linux-pf). |
@hakavlad did you check For liquorix and xanmod. you share output of both having |
There is no |
@dim-geo Is this new kernel also without |
subj
The text was updated successfully, but these errors were encountered: