On Mon, Jul 09, 2012 at 02:11:00AM -0400, Tom Lane wrote:
> yamt@mwd.biglobe.ne.jp (YAMAMOTO Takashi) writes:
> >> Also, I was under the impression that recent Linux kernels use hugepages
> >> automatically if they can, so I wonder exactly what Andres was testing
> >> on ...
>
> > if you mean the "trasparent hugepage" feature, iirc it doesn't affect
> > MAP_SHARED mappings like this.
>
> Oh! That would explain some things. It seems like a pretty nasty
> restriction though ... do you know why they did that?
It doesn't say explicitly in the documentation (found at
http://lwn.net/Articles/423592/ aka transhuge.txt) but reading between
the lines I'm guessing it's due to the fact that huge pages must be
aligned to 2 or 4MB and when dealing with a shared mapping you probably
need to require it to be aligned is all address spaces.
However, it seems it should work for SysV shared memory, see:
http://lwn.net/Articles/375096/ . The same page suggests shared
mappings should work fine. However, this page refers to the
non-transparent feature.
If you think about it, it must work since huge pages are inherited
through fork().
Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts. -- Arthur Schopenhauer