Re: [PATCH] Use MAP_HUGETLB where supported (v3)

From: Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, pgsql-hackers(at)postgresql(dot)org, andres(at)2ndquadrant(dot)com
Subject: Re: [PATCH] Use MAP_HUGETLB where supported (v3)
Date: 2013-10-30 07:28:33
Message-ID: 20131030072833.GG4183@toroid.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At 2013-10-30 00:10:39 -0700, david(at)fetter(dot)org wrote:
>
> How about documenting that 2MB is the quantum (OK, we'll say
> "indivisible unit" or "smallest division" or something) and failing
> with a message to that effect if someone tries to set it otherwise?

I don't think you understand the problem. We're not discussing a user
setting here. The size that is passed to PGSharedMemoryCreate is based
on shared_buffers and our estimates of how much memory we need for other
things like ProcArray (see ipci.c:CreateSharedMemoryAndSemaphores).

If this calculated size is not a multiple of a page size supported by
the hardware (usually 2/4/16MB etc.), the allocation will fail under
some commonly-used kernels. We can either ignore the problem and let
the allocation fail, or try to discover the smallest supported huge
page size (what the patch does now), or assume that 2MB pages can be
used if any huge pages can be used and align accordingly.

We could use a larger size, e.g. if we aligned to 16MB then it would
work on hardware that supported 2/4/8/16MB pages, but we'd waste the
extra memory unless we also increased NBuffers after the rounding up
(which is also something Andres suggested earlier).

I don't have a strong opinion on the available options, other than not
liking the "do nothing" approach.

-- Abhijit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Leonardo Francalanci 2013-10-30 07:55:26 Re: Fast insertion indexes: why no developments
Previous Message David Fetter 2013-10-30 07:10:39 Re: [PATCH] Use MAP_HUGETLB where supported (v3)