From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754449AbcEQI5a (ORCPT ); Tue, 17 May 2016 04:57:30 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35787 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751376AbcEQI52 (ORCPT ); Tue, 17 May 2016 04:57:28 -0400 Date: Tue, 17 May 2016 10:57:25 +0200 From: Michal Hocko To: Sebastian Frias Cc: One Thousand Gnomes , Mason , linux-mm@kvack.org, Andrew Morton , Linus Torvalds , LKML Subject: Re: [PATCH] mm: add config option to select the initial overcommit mode Message-ID: <20160517085724.GD14453@dhcp22.suse.cz> References: <573593EE.6010502@free.fr> <20160513095230.GI20141@dhcp22.suse.cz> <5735AA0E.5060605@free.fr> <20160513114429.GJ20141@dhcp22.suse.cz> <5735C567.6030202@free.fr> <20160513140128.GQ20141@dhcp22.suse.cz> <20160513160410.10c6cea6@lxorguk.ukuu.org.uk> <5735F4B1.1010704@laposte.net> <20160513164357.5f565d3c@lxorguk.ukuu.org.uk> <573AD534.6050703@laposte.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <573AD534.6050703@laposte.net> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 17-05-16 10:24:20, Sebastian Frias wrote: [...] > >> Also, under what conditions would copy-on-write fail? > > > > When you have no memory or swap pages free and you touch a COW page that > > is currently shared. At that point there is no resource to back to the > > copy so something must die - either the process doing the copy or > > something else. > > Exactly, and why does "killing something else" makes more sense (or > was chosen over) "killing the process doing the copy"? Because that "something else" is usually a memory hog and so chances are that the out of memory situation will get resolved. If you kill "process doing the copy" then you might end up just not getting any memory back because that might be a little forked process which doesn't own all that much memory on its own. That would leave you in the oom situation for a long time until somebody actually sitting on some memory happens to ask for CoW... See the difference? -- Michal Hocko SUSE Labs