Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1buRdh-0000Of-HR for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Oct 2016 22:04:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1buRdg-0002Js-W6 for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Oct 2016 22:04:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1buRdg-0002Jm-Ea for pgsql-hackers@postgresql.org; Wed, 12 Oct 2016 22:04:40 +0000 Received: from smtprelay0193.b.hostedemail.com ([64.98.42.193] helo=smtprelay.b.hostedemail.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1buRdc-0000ry-Na for pgsql-hackers@postgresql.org; Wed, 12 Oct 2016 22:04:39 +0000 Received: from filter.hostedemail.com (10.5.19.248.rfc1918.com [10.5.19.248]) by smtprelay03.b.hostedemail.com (Postfix) with ESMTP id 8DEA31A7014; Wed, 12 Oct 2016 22:04:35 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,alvherre@alvh.no-ip.org,:::::::::,RULES_HIT:41:355:379:599:800:960:967:973:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1431:1437:1515:1516:1518:1519:1534:1541:1593:1594:1595:1596:1711:1730:1747:1777:1792:2194:2198:2199:2200:2393:2525:2553:2561:2564:2682:2685:2828:2859:2898:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4605:5007:6119:6261:6630:7903:8603:9025:9108:9121:9190:10004:10400:10466:10848:11232:11658:11914:12043:12663:13069:13073:13311:13357:13439:13894:13895:14040:14093:14097:14181:14721:14764:14819:21080:21324:30054:30070:30090,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: able33_7f48c17937161 X-Filterd-Recvd-Size: 2696 Received: from alvin.alvh.no-ip.org (unknown [216.155.90.98]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf01.b.hostedemail.com (Postfix) with ESMTPA; Wed, 12 Oct 2016 22:04:34 +0000 (UTC) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 965298BA; Wed, 12 Oct 2016 19:04:32 -0300 (CLST) Date: Wed, 12 Oct 2016 19:04:32 -0300 From: Alvaro Herrera To: Tom Lane Cc: Andres Freund , pgsql-hackers@postgresql.org, Heikki Linnakangas , Abhijit Menon-Sen Subject: Re: munmap() failure due to sloppy handling of hugepage size Message-ID: <20161012220432.GA943701@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <31426.1476304418@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: 0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Tom Lane wrote: > Andres Freund writes: > > On October 12, 2016 1:25:54 PM PDT, Tom Lane wrote: > >> A little bit of research suggests that on Linux the thing to do would > >> be to get the actual default hugepage size by reading /proc/meminfo and > >> looking for a line like "Hugepagesize: 2048 kB". > > > We had that, but Heikki ripped it out when merging... I think you're supposed to use /sys to get the available size. > > According to > https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt > looking into /proc/meminfo is the longer-standing API and thus is > likely to work on more kernel versions. Also, if you look into > /sys then you are going to see multiple possible values and it's > not clear how to choose the right one. I'm not sure that this is the best rationale. In my system there are 2MB and 1GB huge page sizes; in systems with lots of memory (let's say 8 GB of shared memory is requested) it seems a clear winner to allocate 8 1GB hugepages than 4096 2MB hugepages because the page table is so much smaller. The /proc interface only shows the 2MB page size, so if we go that route we'd not be getting the full benefit of the feature. We could just fall back to reading /proc if we cannot find the /sys stuff; that makes it continue to work on older kernels. Regarding choosing one among several size choices, I'd think the larger huge page size is always better if the request size is at least that large, otherwise fall back to the next smaller one. (This could stand some actual research). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers