On 02/26/2014 10:35 AM, Christian Kruse wrote:
> On 25/02/14 19:28, Andres Freund wrote:
>> I think all that's needed is to cut the first paragraphs that generally
>> explain what huge pages are in some detail from the text and make sure
>> the later paragraphs don't refer to the earlier ones.
>
> Attached you will find a new version of the patch.
Thanks!
> huge_tlb_pages (enum)
>
> Enables/disables the use of huge TLB pages. Valid values are try (the default), on, and off.
>
> At present, this feature is supported only on Linux. The setting is ignored on other systems.
>
> The use of huge TLB pages results in smaller page tables and less CPU time spent on memory management, increasing
performance.For more details, see Section 17.4.4.
>
> With huge_tlb_pages set to try, the server will try to use huge pages, but fall back to using normal allocation
ifthat fails. With on, failure to use huge pages will prevent the server from starting up. With off, huge pages will
notbe used.
That still says "The setting is ignored on other systems". That's not
quite true: as explained later in the section, if you set
huge_tlb_pages=on and the platform doesn't support it, the server will
refuse to start.
> 17.4.4. Linux huge TLB pages
This section looks good to me. I'm OK with the level of detail, although
maybe just a sentence or two about what huge TLB pages are and what
benefits they have would still be in order. How about adding something
like this as the first sentence:
"Using huge TLB pages reduces overhead when using large contiguous
chunks of memory, like PostgreSQL does."
> To enable this feature in PostgreSQL you need a kernel with CONFIG_HUGETLBFS=y and CONFIG_HUGETLB_PAGE=y. You also
haveto tune the system setting vm.nr_hugepages. To calculate the number of necessary huge pages start PostgreSQL
withouthuge pages enabled and check the VmPeak value from the proc filesystem:
>
> $ head -1 /path/to/data/directory/postmaster.pid
> 4170
> $ grep ^VmPeak /proc/4170/status
> VmPeak: 6490428 kB
>
> 6490428 / 2048 (PAGE_SIZE is 2MB in this case) are roughly 3169.154 huge pages, so you will need at least 3170 huge
pages:
>
> $ sysctl -w vm.nr_hugepages=3170
That's good advice, but perhaps s/calculate/estimate/. It's just an
approximation, after all.
- Heikki