From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6575 invoked by alias); 15 Feb 2013 18:55:23 -0000 Received: (qmail 6561 invoked by uid 22791); 15 Feb 2013 18:55:22 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD,T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pa0-f51.google.com (HELO mail-pa0-f51.google.com) (209.85.220.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 15 Feb 2013 18:55:17 +0000 Received: by mail-pa0-f51.google.com with SMTP id hz1so1857759pad.10 for ; Fri, 15 Feb 2013 10:55:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=FbNJUO1b0jrcSwPHn/grjhFlpH0sIXCBSTuhMHoQWnc=; b=JruqJQtz3g+UDN/fbBD6t1tjB2+O0YooJsnp0Ey0VDzcASVOlXHb4x7hQzthkYkMlA mchetgugbYmE1GC74Vv6mcYWysln7/msPe1QMTojkpsz3b67zvRpzcJVzzq719k6Co+e couz6hBlvpmRrfEl4vlM3K35XR63q1d0r/Mt8sDdOQbZy+8jXty4JiW2YFQOqZSHxAOy SK1Wety30Zkd3N9FrqjAmb7JTnoqPytx7ZJS9m7n1kTvfDP3iA51mtQ1jTHhiwQ/7nFF RGBpUEe08ZkTGd+QLQKHa1O+9u2a/8HKAkgIBeCYdpihhJxhOd2tYSSo3T4dcr+1IK2U OMrw== X-Received: by 10.68.197.4 with SMTP id iq4mr8278666pbc.96.1360954516408; Fri, 15 Feb 2013 10:55:16 -0800 (PST) Received: from iant-glaptop.google.com ([2620:0:1000:3204:7558:b696:1ffd:1788]) by mx.google.com with ESMTPS id jp9sm5492052pbb.7.2013.02.15.10.55.14 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 15 Feb 2013 10:55:15 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org Subject: libgo patch committed: Use MAP_NORESERVE Date: Fri, 15 Feb 2013 18:55:00 -0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Gm-Message-State: ALoCoQnNEseHGZqqeVRlyM2MM12c7yTcPVI1qwWrCf2rwaDwuA6FS4qLDfCgtZIaq7tL46GymLHTPF+rc+J++0qZ5XAsORs0AUnLrxvUP3cYQS/Xf9UlXcBNjXTZ1l7q5gNz31dkDtaaeM9hp2u77C+bZMOl/JLk6HuPr6T1KrW2QFQsHscl8Zypo1f/TAfCOf+69Gqbr0hdBm2ZEh7KgHlObgV4EGd6+g== X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2013-02/txt/msg00790.txt.bz2 --=-=-= Content-length: 287 This patch from Janne Snabb changes libgo to use MAP_NORESERVE when allocating the large memory arena. This makes no difference on GNU/Linux but reportedly helps on OpenIndiana and OpenSolaris. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=foo.patch Content-Description: patch Content-length: 805 diff -r 38275c614957 libgo/runtime/mem.c --- a/libgo/runtime/mem.c Fri Feb 15 10:48:31 2013 -0800 +++ b/libgo/runtime/mem.c Fri Feb 15 10:49:37 2013 -0800 @@ -18,6 +18,10 @@ #endif #endif +#ifndef MAP_NORESERVE +#define MAP_NORESERVE 0 +#endif + #ifdef USE_DEV_ZERO static int dev_zero = -1; #endif @@ -134,7 +138,11 @@ return v; } - p = runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0); + // Use the MAP_NORESERVE mmap() flag here because typically most of + // this reservation will never be used. It does not make sense + // reserve a huge amount of unneeded swap space. This is important on + // systems which do not overcommit memory by default. + p = runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE|MAP_NORESERVE, fd, 0); if(p == MAP_FAILED) return nil; return p; --=-=-=--