Re: patch: add MAP_HUGETLB to mmap() where supported (WIP) - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: patch: add MAP_HUGETLB to mmap() where supported (WIP)
Date
Msg-id 5236BE20.6040904@vmware.com
Whole thread Raw
In response to patch: add MAP_HUGETLB to mmap() where supported (WIP)  (Richard Poole <richard@2ndQuadrant.com>)
Responses Re: patch: add MAP_HUGETLB to mmap() where supported (WIP)
List pgsql-hackers
On 14.09.2013 02:41, Richard Poole wrote:
> The attached patch adds the MAP_HUGETLB flag to mmap() for shared memory
> on systems that support it. It's based on Christian Kruse's patch from
> last year, incorporating suggestions from Andres Freund.

I don't understand the logic in figuring out the pagesize, and the 
smallest supported hugepage size. First of all, even without the patch, 
why do we round up the size passed to mmap() to the _SC_PAGE_SIZE? 
Surely the kernel will round up the request all by itself. The mmap() 
man page doesn't say anything about length having to be a multiple of 
pages size.

And with the patch, why do you bother detecting the minimum supported 
hugepage size? Surely the kernel will choose the appropriate hugepage 
size just fine on its own, no?

> It is still WIP as there are a couple of points that Andres has pointed
> out to me that haven't been addressed yet;

Which points are those?

I wonder if it would be better to allow setting huge_tlb_pages=try even 
on platforms that don't have hugepages. It would simply mean the same as 
'off' on such platforms.

- Heikki



pgsql-hackers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: GIN improvements part 1: additional information
Next
From: Boszormenyi Zoltan
Date:
Subject: Re: UNNEST with multiple args, and TABLE with multiple funcs