REOPENED251134
[WPE] Linux memory pressure for swap memory
https://bugs.webkit.org/show_bug.cgi?id=251134
Summary [WPE] Linux memory pressure for swap memory
Donghwa Kim
Reported 2023-01-24 21:42:01 PST
Hi, I am using webkit browser for my embedded linux platform with memory swap. However, when I check the source code, I can see that MemoryPressureHandlerLinux.cpp does not consider swap memory. Looking inside the MemoryUsagePoller function, we are only monitoring the VmRSS value. So, in the Linux environment using memory swap (HDD swap, etc.), I confirmed that memory clear (garbage collection) is not done at the time I expect. This will result in OOM of the platform in severe cases. I'd suggest that not only the VmRSS values should be monitored, but also the VmSwap as well.
Attachments
Donghwa Kim
Comment 1 2023-01-24 21:54:07 PST
This is my suggetion : diff --git a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp index fb86ee9d996d..674ff297837c 100644 --- a/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp +++ b/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp @@ -248,13 +248,14 @@ MemoryPressureHandler::MemoryUsagePoller::MemoryUsagePoller() bool critical = false; bool synchronous = false; size_t value = 0; + size_t value_swap = 0; if (s_pollMaximumProcessMemoryCriticalLimit) { - if (readToken(s_processStatus, "VmRSS:", KB, value)) { - if (value > s_pollMaximumProcessMemoryNonCriticalLimit) { + if (readToken(s_processStatus, "VmRSS:", KB, value) && readToken(s_processStatus, "VmSwap:", KB, value_swap)) { + if (value + value_swap > s_pollMaximumProcessMemoryNonCriticalLimit) { underMemoryPressure = true; - critical = value > s_pollMaximumProcessMemoryCriticalLimit; - synchronous = value > s_pollMaximumProcessMemoryCriticalLimit * 1.05; + critical = value + value_swap > s_pollMaximumProcessMemoryCriticalLimit; + synchronous = value + value_swap > s_pollMaximumProcessMemoryCriticalLimit * 1.05; } } }
Donghwa Kim
Comment 2 2023-01-24 23:37:39 PST
Sorry. I should report this issue to the WPEWebkit project. I will closed it.
Adrian Perez
Comment 3 2023-01-25 02:54:48 PST
(In reply to Donghwa Kim from comment #2) > Sorry. I should report this issue to the WPEWebkit project. > I will closed it. Hi Donghwa! You have reported your bug correctly... this Bugzilla is for all the WebKit ports, including WPE =) Let's reopen this, I am CC'ing a coouple of developers who may have a better idea than me about this topic.
Miguel Gomez
Comment 4 2023-01-25 03:30:08 PST
While the upstream version of WPE has the same problem, the code Donghwa is referring to belongs to the WebPlatformForEmbedded version of WPE.
Donghwa Kim
Comment 5 2023-01-25 03:50:05 PST
Here is my WPEWebkit pull request link : https://github.com/WebPlatformForEmbedded/WPEWebKit/pull/1017
Note You need to log in before you can comment on or make changes to this bug.