From owner-cvs-all@FreeBSD.ORG Mon Dec 31 00:59:17 2007 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4461816A418; Mon, 31 Dec 2007 00:59:17 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 37D5C13C448; Mon, 31 Dec 2007 00:59:17 +0000 (UTC) (envelope-from jasone@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lBV0xH4j076513; Mon, 31 Dec 2007 00:59:17 GMT (envelope-from jasone@repoman.freebsd.org) Received: (from jasone@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lBV0xHX4076512; Mon, 31 Dec 2007 00:59:17 GMT (envelope-from jasone) Message-Id: <200712310059.lBV0xHX4076512@repoman.freebsd.org> From: Jason Evans Date: Mon, 31 Dec 2007 00:59:16 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/lib/libc/stdlib malloc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2007 00:59:17 -0000 jasone 2007-12-31 00:59:16 UTC FreeBSD src repository Modified files: lib/libc/stdlib malloc.c Log: Fix a bug related to sbrk() calls that could cause address space leaks. This is a long-standing bug, but until recent changes it was difficult to trigger, and even then its impact was non-catastrophic, with the exception of revision 1.157. Optimize chunk_alloc_mmap() to avoid the need for unmapping pages in the common case. Thanks go to Kris Kennaway for a patch that inspired this change. Do not maintain a record of previously mmap'ed chunk address ranges. The original intent was to avoid the extra system call overhead in chunk_alloc_mmap(), which is no longer a concern. This also allows some simplifications for the tree of unused DSS chunks. Introduce huge_mtx and dss_chunks_mtx to replace chunks_mtx. There was no compelling reason to use the same mutex for these disjoint purposes. Avoid memset() for huge allocations when possible. Maintain two trees instead of one for tracking unused DSS address ranges. This allows scalable allocation of multi-chunk huge objects in the DSS. Previously, multi-chunk huge allocation requests failed if the DSS could not be extended. Revision Changes Path 1.159 +268 -186 src/lib/libc/stdlib/malloc.c