Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754042AbYKFBPq (ORCPT ); Wed, 5 Nov 2008 20:15:46 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752952AbYKFBPi (ORCPT ); Wed, 5 Nov 2008 20:15:38 -0500 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:39213 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752513AbYKFBPh (ORCPT ); Wed, 5 Nov 2008 20:15:37 -0500 From: KOSAKI Motohiro To: Hugh Dickins Subject: Re: /proc/pid/maps containg anonymous maps that have PROT_NONE Cc: kosaki.motohiro@jp.fujitsu.com, =?SHIFT_JIS?B?VPZy9ms=?= Edwin , Linux Kernel In-Reply-To: References: <49118010.20202@gmail.com> Message-Id: <20081106100727.0D35.KOSAKI.MOTOHIRO@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.42 [ja] Date: Thu, 6 Nov 2008 10:15:21 +0900 (JST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1503 Lines: 42 > [pid 31928] mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0 > [pid 31938] futex(0x7ffff6e489e0, FUTEX_WAKE_PRIVATE, 1 > [pid 31928] <... mmap resumed> ) = 0x7fffe2bd3000 > > which maps 7fffe2bd3000-7fffeabd3000; then > > [pid 31928] munmap(0x7fffe2bd3000, 21155840 > [pid 31938] <... futex resumed> ) = 0 > [pid 31928] <... munmap resumed> ) = 0 > > which unmaps 7fffe2bd3000-7fffe4000000; and then > > [pid 31928] munmap(0x7fffe8000000, 45953024) = 0 > > which unmaps 7fffe8000000-7fffeabd3000. > > So it's trimming off the rough edges to leave 7fffe4000000-7fffe8000000 > mapped PROT_NONE, then mprotecting what it needs of that. > > Why does it mmap too much then trim it down? Perhaps it's trying to > minimize pagetable usage, perhaps it's internally convenient to base > on rounded addresses, I don't know. Yup. glibc malloc's arena need heap size alignment. it cause that struct arena address can calcurate "arena = any_ptr & ~(HEAP_SIZE-1)" as old linux's "current" macro calculation. > But the mmap is there: just easily overlooked because of the way it > munmaps too (with strace showing hex addresses but decimal sizes). -- 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/