Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758102AbbFCQer (ORCPT ); Wed, 3 Jun 2015 12:34:47 -0400 Received: from pd.grulic.org.ar ([200.16.16.187]:53099 "EHLO pd.grulic.org.ar" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756408AbbFCQej (ORCPT ); Wed, 3 Jun 2015 12:34:39 -0400 X-Greylist: delayed 462 seconds by postgrey-1.27 at vger.kernel.org; Wed, 03 Jun 2015 12:34:39 EDT Date: Wed, 3 Jun 2015 13:26:49 -0300 From: Marcos Dione To: Michal Hocko Cc: linux-kernel@vger.kernel.org, marcos-david.dione@amadeus.com, linux-mm@kvack.org Subject: Re: committed memory, mmaps and shms Message-ID: <20150603162649.GA15166@grulic.org.ar> References: <20150311181044.GC14481@diablo.grulicueva.local> <20150312124053.GA30035@dhcp22.suse.cz> <20150312145422.GA9240@grulic.org.ar> <20150312153513.GA14537@dhcp22.suse.cz> <20150312165600.GC9240@grulic.org.ar> <20150313145851.GA26332@grulic.org.ar> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150313145851.GA26332@grulic.org.ar> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2501 Lines: 76 On Fri, Mar 13, 2015 at 11:58:51AM -0300, Marcos Dione wrote: > On Thu, Mar 12, 2015 at 01:56:00PM -0300, Marcos Dione wrote: > > On Thu, Mar 12, 2015 at 11:35:13AM -0400, Michal Hocko wrote: > > > On Wed 11-03-15 19:10:44, Marcos Dione wrote: > > > I also read Documentation/vm/overcommit-accounting > > > > What would help you to understand it better? > > I think it's mostly a language barrier. The doc talks about of how > the kernel handles the memory, but leaves userland people 'watching from > outside the fence'. From the sysadmin and non-kernel developer (that not > necesarily knows all the kinds of things that can be done with > malloc/mmap/shem/&c) point of view, this is what I think the doc refers > to: > > > How It Works > > ------------ > > > > The overcommit is based on the following rules > > > > For a file backed map > > mmaps. are there more? answering myself: yes, code maps behave like this. > > SHARED or READ-only - 0 cost (the file is the map not swap) > > PRIVATE WRITABLE - size of mapping per instance code is not writable, so only private writable mmaps are left. I wonder why shared writable are accounted. > > For an anonymous > > malloc'ed memory > > > or /dev/zero map > > hmmm, (read only?) mmap'ing on top of /dev/zero? > > > SHARED - size of mapping > > a shared anonymous memory is a shm? > > > PRIVATE READ-only - 0 cost (but of little use) > > PRIVATE WRITABLE - size of mapping per instance > > I can't translate these two terms, unless the latter is the one > refering specifically to mmalloc's. I wonder how could create several > intances of the 'same' mapping in that case. forks? > > > Additional accounting > > Pages made writable copies by mmap > > Hmmm, copy-on-write pages for when you write in a shared mmap? I'm > wild guessing here, even when what I say doesn't make any sense. > > > shmfs memory drawn from the same pool > > Beats me. [...] > Now it seems too simple! What I'm missing? :) Cheers, untrue, I'm still in the dark on what those mean. maybe someone can translate those terms to userland terms? malloc, shm, mmap, code maps? probably I'm missing some. cheers, -- Marcos. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/