Out-of-memory victim selection with BPF
lwn.net
lwn.net
edit: I found about:unloads which shows tabs memory usage and unload order
I've just taken a look at that and it's weird. It says all my tabs have been last accessed "right now". If I click refresh, the last access time updates to that moment. This is Firefox 116.0.3 on Linux.
I wonder if this could be related to my using a single tab per window (I have a window manager whose job is to... manage windows).
This is interesting. I usually use firefox with i3 in tabbed mode, so only one window visible at a time. On some sites, when I switch to another tab that hides the previous one, any sound playing would stop. But if I display the two windows side by side, switching to the other window wouldn't stop the sound in the initial window. So I'm guessing that window visibility must be somehow communicated to the browser, if websites can act on it.
Edit: this also happens with chromium in the same configuration: I have Teams running in PWA mode on the same desktop as Outlook, also in PWA mode, both tiled by the WM. Teams will get suspended after a while if it's not the selected tab, but it'll stay active if it's on top.
I can imagine this can be useful in server farms
if you can read Chinese, see also: https://twitter.com/Manjusaka_Lee/status/1692084961330028802...
Text from image, cut to abberviate:
> 1. the current usage scenario of bytes for such a feature. I can
I can think of is to avoid some critical processes like kubelet to be OOM to ensure better stability. I don't know if my understanding is I don't know if I'm wrong or not.
Yes, on the one hand, we want to make sure that important daemons like kubelet are not killed by mistake. On the one hand, we want to make sure that critical daemons like kubelet don't get killed by mistake; on the other hand, nowadays, big companies tend to run multiple types of tasks together to improve resource utilization, and in the case of OOM, we would like to make sure that we have the right resources. And when it comes to OOM, we want to make decisions based on quality of service requirements, not on memory consumption. In the past, Ali and Google used to prioritize their tasks by setting the user's priority on the memcg priority setting by users to achieve this function, but BPF may be more flexible and applicable to more scenarios.
> Another question I have is if we introduce BPF in OOM eviction scenarios.
I have another question of my own: if we introduce BPF in an OOM eviction scenario > program (in effect introducing a BPF
> program (in effect, introducing the runtime unpredictability of the additional programmability).
time unpredictability due to the additional programmability), might it not be possible that a system stability-peddling program such as OOM
could lead to a system stabilization scheme such as OOM not > working as expected, leading to more systemic problems.
> work as expected, leading to further destabilization of the system.
Yes. I haven't done the exact math on the extra overhead, but I'm optimistic. We can see that BPF has even done some work on kernel tuning. On the other hand, a user can easily write a kernel BPF to write a "bad" or even "malicious" BPF, which is really a matter of whether we trust the user completely. At the beginning of the implementation, I also did some backstabbing on the kernel side to make sure that at least one victim could be selected, but Michal probably thought this was unnecessary (https:/llore.kernel.org must kml/ZMzhDFhvol2VQBE4@dhcp22.suse.cz/).
Tweet text as seen on Nitter:
A patch from ByteDance that attempts to programmable the kernel's OOM eviction behavior via BPF. I find this interesting. @flaneur2023 Aug 17
This makes sense, adding an if else anyway don't kill this logic for OOM time would work pretty well NadeshikoManju @SwingingCamping S3 2024 On!
@Manjusaka_Lee Aug 17 Replying to @flaneur2023
Further discussion between me and the author Aug 17, 2023 - 8:04 AM UTC
[[image]]
@ayanamist Aug 17
Replying to @Manjusaka_Lee @flaneur2023
It should be mainly a mixed section claim, it's a pain in the ass to adjust the oom scores by process as well
a) there is only one user
b) they are logged in
c) they will be able to respond in a timely enough manner to allow other programs to allocate memory shortly
edit: d) there will be enough memory to start a program that is responsible for asking the user, and if it needs to connect to a display server then the display server will be able to allocate memory for surfaces that program can draw to to display the request to the user.
I was indirectly pointing out how Linux on the Desktop is never really going to happen for normal people while the kernel devs ignore obvious desktop requirements like this.
Windows solved this problem over 20 years ago.
Lack of overcommit probably helps a bit, but it's a bit of a red herring. The real thing that Linux lacks is a GUI integrated into the kernel. There's literally no way for Linux to do anything like this.
(It might not actually require a kernel GUI but it definitely requires special treatment of the GUI by the kernel and it doesn't do that.)
Windows does have an early-oom like solution where it pops up a warning if you are getting close to running out of memory with an option to kill the highest-memory application, and it will also automatically expand swap if you have allowed it to do so great option if you don't like free disk space, but if both those fail it will crash hard
This post suggests it has at least some fairly tight integration with the kernel (and that it does work quite reliably):
https://www.reddit.com/r/explainlikeimfive/comments/1pbctv/e...
Berkley Packet Filter?
14 years on here and I'm kinda alarmed by HN lately, it's gone from people reading 20% of the time to 1%. article is inscrutable, and literally the entire set of 30 comments are:
- Firefox memory usage.
- why decide dynamically?
- why not just ask the user?