<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Linux OOM Killer</title>
	<atom:link href="http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/feed/" rel="self" type="application/rss+xml" />
	<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/</link>
	<description>Ideas on Databases, Logic, and Language by Jeff Davis</description>
	<lastBuildDate>Sat, 10 Jul 2010 14:36:49 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Wolfgang Draxinger</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-233</link>
		<dc:creator>Wolfgang Draxinger</dc:creator>
		<pubDate>Sun, 04 Jul 2010 01:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-233</guid>
		<description>The OOM killer is also quite annoying if you rely on garbage collection. The problem for GC is, that most CG implementations will defer garbage collection, until allocating new memory/VM won&#039;t work, in which case OOM is assumed, garbage collected and allocation retried. Garbage collection is a very good counter example of when freeing memory in a OOM situation is well defined and doesn&#039;t run into the mentioned rollback trouble.

Since malloc and sbrk are allocating VM, I think there should be a mechanism, that kindly signals processes to free memory, before getting into a severe OOM situation. Not as a reaction of acute memory demands, but a kernel process, that constantly monitors the system and every now and then nudges the processes.

A good criterion for that would be the ratio of a process allocated pages / pages recently accessed. For garbage collected, but also leaking processes this number may grow rather quickly. In the case of a process, which actually freed up memory in that situation, the kernel could give bonus points, not to kill it in OOM. It could also track statistics about the average of the additionally mapped pages during memory deallocation, the fewer the better.</description>
		<content:encoded><![CDATA[<p>The OOM killer is also quite annoying if you rely on garbage collection. The problem for GC is, that most CG implementations will defer garbage collection, until allocating new memory/VM won&#8217;t work, in which case OOM is assumed, garbage collected and allocation retried. Garbage collection is a very good counter example of when freeing memory in a OOM situation is well defined and doesn&#8217;t run into the mentioned rollback trouble.</p>
<p>Since malloc and sbrk are allocating VM, I think there should be a mechanism, that kindly signals processes to free memory, before getting into a severe OOM situation. Not as a reaction of acute memory demands, but a kernel process, that constantly monitors the system and every now and then nudges the processes.</p>
<p>A good criterion for that would be the ratio of a process allocated pages / pages recently accessed. For garbage collected, but also leaking processes this number may grow rather quickly. In the case of a process, which actually freed up memory in that situation, the kernel could give bonus points, not to kill it in OOM. It could also track statistics about the average of the additionally mapped pages during memory deallocation, the fewer the better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: thesis</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-227</link>
		<dc:creator>thesis</dc:creator>
		<pubDate>Sun, 20 Jun 2010 10:12:34 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-227</guid>
		<description>buy &lt;a href=&quot;http://www.bestdissertation.com/services/thesis.html&quot; rel=&quot;nofollow&quot;&gt;thesis&lt;/a&gt;, it will help you in learning and save your time</description>
		<content:encoded><![CDATA[<p>buy <a href="http://www.bestdissertation.com/services/thesis.html" rel="nofollow">thesis</a>, it will help you in learning and save your time</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: toro lawn mower parts</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-218</link>
		<dc:creator>toro lawn mower parts</dc:creator>
		<pubDate>Sat, 05 Jun 2010 19:14:05 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-218</guid>
		<description>Amazing, it runs extremely nice. Thank you</description>
		<content:encoded><![CDATA[<p>Amazing, it runs extremely nice. Thank you</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lou Gosselin</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-177</link>
		<dc:creator>Lou Gosselin</dc:creator>
		<pubDate>Fri, 26 Feb 2010 02:43:23 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-177</guid>
		<description>Like you, I am completely dumbfounded with the &quot;solution&quot; to this problem. 

I am pro-Linux, but that any of the kernel developers defend this OOM mechanism is an embarrassment. It&#039;s so obviously wrong to arbitrarily kill processes by any heuristic. Even if the heuristic were improved, there&#039;s no reason (ever) to be killing off applications which were behaving correctly. Sounds like that was designed by a banker, doesn&#039;t it?

Process badness?? Who are we kidding here, this is pure kernel badness. This is a glaring flaw on an otherwise reliable platform. 

The solution should address the real problems:
1. The system should never over-commit. Not enough memory to fulfill a new memory request, then fail *deterministically* where applications can deal with it.

2. If this prevents a process from forking, then so be it. At least the system remains stable, and the failed request can be handled gracefully.

3. Maybe the fork/exec combination is fundamentally flawed. Even when it works it&#039;s not particularly efficient, this could be an opportunity to improve the system calls.

4. Some feel that over-commit is desirable. I personally disagree that this is acceptable in any production setting, but if it&#039;s necessary then it should be explicit. The kernel must always honor the memory contracts between itself and processes, no exceptions. If an application wants/needs to over commit ram it probably won&#039;t use, then let it do so explicitly and at it&#039;s own risk.

Conceptually a modified fork call could keep the parent safe from overcommit, and allow it&#039;s child to over commit until it runs exec, the new executable could do whatever it pleases with regards to overcommit, but by default all processes have the right to expect the kernel will honor it&#039;s obligations. 

I simply cannot believe my ears when i hear Linux kernel hackers debating  OOM process killer selection heuristics rather than how to actually fix the problem.</description>
		<content:encoded><![CDATA[<p>Like you, I am completely dumbfounded with the &#8220;solution&#8221; to this problem. </p>
<p>I am pro-Linux, but that any of the kernel developers defend this OOM mechanism is an embarrassment. It&#8217;s so obviously wrong to arbitrarily kill processes by any heuristic. Even if the heuristic were improved, there&#8217;s no reason (ever) to be killing off applications which were behaving correctly. Sounds like that was designed by a banker, doesn&#8217;t it?</p>
<p>Process badness?? Who are we kidding here, this is pure kernel badness. This is a glaring flaw on an otherwise reliable platform. </p>
<p>The solution should address the real problems:<br />
1. The system should never over-commit. Not enough memory to fulfill a new memory request, then fail *deterministically* where applications can deal with it.</p>
<p>2. If this prevents a process from forking, then so be it. At least the system remains stable, and the failed request can be handled gracefully.</p>
<p>3. Maybe the fork/exec combination is fundamentally flawed. Even when it works it&#8217;s not particularly efficient, this could be an opportunity to improve the system calls.</p>
<p>4. Some feel that over-commit is desirable. I personally disagree that this is acceptable in any production setting, but if it&#8217;s necessary then it should be explicit. The kernel must always honor the memory contracts between itself and processes, no exceptions. If an application wants/needs to over commit ram it probably won&#8217;t use, then let it do so explicitly and at it&#8217;s own risk.</p>
<p>Conceptually a modified fork call could keep the parent safe from overcommit, and allow it&#8217;s child to over commit until it runs exec, the new executable could do whatever it pleases with regards to overcommit, but by default all processes have the right to expect the kernel will honor it&#8217;s obligations. </p>
<p>I simply cannot believe my ears when i hear Linux kernel hackers debating  OOM process killer selection heuristics rather than how to actually fix the problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PiperOq</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-172</link>
		<dc:creator>PiperOq</dc:creator>
		<pubDate>Wed, 13 Jan 2010 19:23:39 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-172</guid>
		<description>Oh, what I can observe? Same superior release just about this good topic I utilized for &lt;a href=&quot;http://www.4submission.com&quot; rel=&quot;nofollow&quot;&gt;article submission service&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Oh, what I can observe? Same superior release just about this good topic I utilized for <a href="http://www.4submission.com" rel="nofollow">article submission service</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan P</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-164</link>
		<dc:creator>Evan P</dc:creator>
		<pubDate>Tue, 08 Dec 2009 09:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-164</guid>
		<description>Sorry, some sloppy thinking on my part. What I said is only true if the application is free()ing and never malloc()ing, and the kernel is off by whatever amortization margin the malloc() implementation uses (3MB for the typical FreeBSD 8.0 configuration, as I mentioned earlier).

Your syscall idea is like an mlock() that reserves either or both of RAM and swap instead of only RAM, or like a MAP_RESERVE flag for Linux&#039;s mmap() to compliment the MAP_NORESERVE flag. I think there&#039;s some merit to that suggestion.

The only other thing I&#039;d note is that heap implementations typically give each thread its own arena so as to minimize lock contention on SMP systems. Each of them would need an independent amortized syscall; what I&#039;m getting at is that if this were a workable solution in general, /proc/sys/vm/overcommit_memory==2 would be the default.

Of course, it&#039;s probably a perfectly workable default for people running Postgres ;-)</description>
		<content:encoded><![CDATA[<p>Sorry, some sloppy thinking on my part. What I said is only true if the application is free()ing and never malloc()ing, and the kernel is off by whatever amortization margin the malloc() implementation uses (3MB for the typical FreeBSD 8.0 configuration, as I mentioned earlier).</p>
<p>Your syscall idea is like an mlock() that reserves either or both of RAM and swap instead of only RAM, or like a MAP_RESERVE flag for Linux&#8217;s mmap() to compliment the MAP_NORESERVE flag. I think there&#8217;s some merit to that suggestion.</p>
<p>The only other thing I&#8217;d note is that heap implementations typically give each thread its own arena so as to minimize lock contention on SMP systems. Each of them would need an independent amortized syscall; what I&#8217;m getting at is that if this were a workable solution in general, /proc/sys/vm/overcommit_memory==2 would be the default.</p>
<p>Of course, it&#8217;s probably a perfectly workable default for people running Postgres <img src='http://thoughts.j-davis.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pádraig Brady</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-162</link>
		<dc:creator>Pádraig Brady</dc:creator>
		<pubDate>Mon, 07 Dec 2009 14:11:10 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-162</guid>
		<description>If FreeBSD handles it fine then that&#039;s cool (albeit beside the point). PostgreSQL will exit or is in a detectable bad state and can be restarted.</description>
		<content:encoded><![CDATA[<p>If FreeBSD handles it fine then that&#8217;s cool (albeit beside the point). PostgreSQL will exit or is in a detectable bad state and can be restarted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Log Buffer</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-161</link>
		<dc:creator>Log Buffer</dc:creator>
		<pubDate>Fri, 04 Dec 2009 20:25:06 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-161</guid>
		<description>&quot;[...]From Jeff Davis’s Experimental Thoughts comes this post on Postgres and the Linux OOM Killer. ... Yes, that would make any Postgres DBA feel kind of ranty.&quot;

&lt;a href=&quot;http://www.pythian.com/news/6165/log-buffer-171-a-carnival-of-the-vanities-for-dbas/&quot; rel=&quot;nofollow&quot;&gt;Log Buffer #171&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>&#8220;[...]From Jeff Davis’s Experimental Thoughts comes this post on Postgres and the Linux OOM Killer. &#8230; Yes, that would make any Postgres DBA feel kind of ranty.&#8221;</p>
<p><a href="http://www.pythian.com/news/6165/log-buffer-171-a-carnival-of-the-vanities-for-dbas/" rel="nofollow">Log Buffer #171</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-160</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Wed, 02 Dec 2009 19:09:49 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-160</guid>
		<description>&quot;kernel already knows exactly how much memory the application is using&quot;

Knows how much the application is using, or knows how much malloc has told the application that it can use?

I thought the problem was VM space versus actually allocated memory.

If, in addition to allocating VM space, malloc explicitly asked the OS to reserve memory (say, every 1024 pages or so to amortize the cost of a syscall) before returning a valid pointer, then the OS would have an opportunity to say &quot;there&#039;s no way I can reserve those pages for you&quot;, and malloc could return NULL.

I understand there are still COW issues with fork and dlopen, but I&#039;m not looking for a perfect solution. In those cases the OS has a pretty good idea how much it has extended itself (number of processes sharing that page that might try to write).

The main problem is with malloc, where (as you say) there is such a huge disconnect between the VM size and the memory that the application has requested that the OS doesn&#039;t know what kind of trouble its in early enough, and even if it does, malloc has no way of knowing the OS may not be able to satisfy the requests.</description>
		<content:encoded><![CDATA[<p>&#8220;kernel already knows exactly how much memory the application is using&#8221;</p>
<p>Knows how much the application is using, or knows how much malloc has told the application that it can use?</p>
<p>I thought the problem was VM space versus actually allocated memory.</p>
<p>If, in addition to allocating VM space, malloc explicitly asked the OS to reserve memory (say, every 1024 pages or so to amortize the cost of a syscall) before returning a valid pointer, then the OS would have an opportunity to say &#8220;there&#8217;s no way I can reserve those pages for you&#8221;, and malloc could return NULL.</p>
<p>I understand there are still COW issues with fork and dlopen, but I&#8217;m not looking for a perfect solution. In those cases the OS has a pretty good idea how much it has extended itself (number of processes sharing that page that might try to write).</p>
<p>The main problem is with malloc, where (as you say) there is such a huge disconnect between the VM size and the memory that the application has requested that the OS doesn&#8217;t know what kind of trouble its in early enough, and even if it does, malloc has no way of knowing the OS may not be able to satisfy the requests.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Farina</title>
		<link>http://thoughts.j-davis.com/2009/11/29/linux-oom-killer/comment-page-1/#comment-159</link>
		<dc:creator>Dan Farina</dc:creator>
		<pubDate>Wed, 02 Dec 2009 18:08:12 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=200#comment-159</guid>
		<description>Then the distributors can complain :)  But end users that install Postgres will be happier and less surprised and the region of pain will shrink a little bit to packages.  Sub-ideal, but progress.</description>
		<content:encoded><![CDATA[<p>Then the distributors can complain <img src='http://thoughts.j-davis.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   But end users that install Postgres will be happier and less surprised and the region of pain will shrink a little bit to packages.  Sub-ideal, but progress.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
