<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:tonikitoo@webkit.org" title="Antonio Gomes <tonikitoo@webkit.org>"> <span class="fn">Antonio Gomes</span></a>
</span> changed
<a class="bz_bug_link
bz_status_NEW "
title="NEW - [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation"
href="https://bugs.webkit.org/show_bug.cgi?id=159346">bug 159346</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Attachment #283522 Flags</td>
<td>review?
</td>
<td>review+
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation"
href="https://bugs.webkit.org/show_bug.cgi?id=159346#c9">Comment # 9</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [GLib] Use a GSource instead of a thread to poll memory pressure eventFD in linux implementation"
href="https://bugs.webkit.org/show_bug.cgi?id=159346">bug 159346</a>
from <span class="vcard"><a class="email" href="mailto:tonikitoo@webkit.org" title="Antonio Gomes <tonikitoo@webkit.org>"> <span class="fn">Antonio Gomes</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=283522&action=diff" name="attach_283522" title="Updated patch">attachment 283522</a> <a href="attachment.cgi?id=283522&action=edit" title="Updated patch">[details]</a></span>
Updated patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=283522&action=review">https://bugs.webkit.org/attachment.cgi?id=283522&action=review</a>
r=me.
I think I can't make use of it yet out of the box on my Linux box, because applications (including webkit based browsers) can not read '/sys/fs/cgroup/memory/memory.pressure_level'.
$ ls -ls /sys/fs/cgroup/memory/
(..)
0 --w--w--w-. 1 root root 0 Jul 5 11:37 cgroup.event_control
(..)
0 ----------. 1 root root 0 Jul 5 11:37 memory.pressure_level
(..)
I have to manually change the permissions.
<span class="quote">>>> Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp:230
>>> + m_eventFDPoller = std::make_unique<EventFDPoller>(m_eventFD.value(), [this] {
>>
>> So my understand is that m_eventFDPoller is an alternative memory pressure source that works independent from the existing 'cgroup' solution, right?
>>
>> However, it gets initialized after the cgroup initialization stuff (lines 209 and 215). So, if cgroup fails to initialize - which happens in most cases - then ::install bails out earlier (lines 218 and 225) and line 230 is not executed.
>>
>> Should line 230 be our first option, and cgroup the second?
>
> No, cgroups work with an evenfd. You create an eventfd and pass the file descriptor to the cgroup event control, by writing a line to /sys/fs/cgroup/memory/cgroup.event_control. The kernel uses the passed fd to notify about critical memory situations. In <a class="bz_bug_link
bz_status_NEW "
title="NEW - MemoryPressureHandler doesn't work if cgroups aren't present in Linux"
href="show_bug.cgi?id=155255">bug #155255</a> I also use an eventfd because it's light an efficient and we can reuse most of the cgroups code.</span >
Ok.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>