logoalt Hacker News

loeglast Friday at 8:36 PM4 repliesview on HN

Why? Most COWed pages will remain untouched. They only need to allocate when touched.


Replies

pm215last Friday at 8:43 PM

Because the point of forbidding overcommit is to ensure that the only time you can discover you're out of memory is when you make a syscall that tries (explicitly or implicitly) to allocate more memory. If you don't account the COW pages to both the parent and the child process, you have a situation where you can discover the out of memory condition when the process tries to dirty the RAM and there's no page available to do that with...

show 1 reply
mahkohlast Friday at 8:46 PM

The point of disabling overcommit, as per the article, is that all pages in virtual memory must be backed by physical memory at all times. Therefore all virtual memory must reserve physical memory at the time of the fork call, even if the contents of the pages only get copied when they are touched.

show 1 reply
Tuna-Fishlast Friday at 8:46 PM

If you have overcommit on, that happens. But if you have it off, it has to assume the worst case, otherwise there can be a failure when someone writes to a page.