From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757623Ab2CEUEc (ORCPT ); Mon, 5 Mar 2012 15:04:32 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59808 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757286Ab2CEUE2 (ORCPT ); Mon, 5 Mar 2012 15:04:28 -0500 Date: Mon, 5 Mar 2012 12:04:27 -0800 From: Andrew Morton To: Sasha Levin Cc: linux-mm@kvack.org, Dave Jones , Thomas Gleixner , "linux-kernel@vger.kernel.org" , Pekka Enberg Subject: Re: OOM killer even when not overcommiting Message-Id: <20120305120427.2d11d30e.akpm@linux-foundation.org> In-Reply-To: <1330977506.1589.59.camel@lappy> References: <1330977506.1589.59.camel@lappy> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 05 Mar 2012 21:58:26 +0200 Sasha Levin wrote: > Hi all, > I assumed that when setting overcommit_memory=2 and > overcommit_ratio<100 that the OOM killer won't ever get invoked (since > we're not overcommiting memory), but it looks like I'm mistaken since > apparently a simple mmap from userspace will trigger the OOM killer if > it requests more memory than available. > > Is it how it's supposed to work? Why does it resort to OOM killing > instead of just failing the allocation? > > Here is the dump I get when the OOM kicks in: > > ... > > [ 3108.730350] [] mlock_vma_pages_range+0x9a/0xa0 > [ 3108.734486] [] mmap_region+0x28b/0x510 > ... The vma is mlocked for some reason - presumably the app is using mlockall() or mlock()? So the kernel is trying to instantiate all the pages at mmap() time.