PING: Linux: Support transparent hugepages

Andrew Haley aph at redhat.com
Fri Apr 1 11:38:09 PDT 2011


On 04/01/2011 07:24 PM, Igor Veresov wrote:
> Why is alignment required? Afaik it's perfectly fine to have mixed page 
> sizes in a single segment.

Alignment is the only way to guarantee that all pages are huge pages.

> Also, if use use +UseLargePages, all the heap and generation sizes
> will be largepage-alinged anyway. Also, some things like the
> NUMA-allocator will work better is they know kind of pages the
> underlying segment has.

Yes, but on Linux at least +UseLargePages (using all that SHM stuff)
needs special permissions, so it tends not to be used as much as it
could.

> What I would've done is put some logic to distinguish kernels that
> support transparent large pages and instead of using all the SHM
> stuff just use a mmap + madvise(MADV_HUGEPAGE).

Actually, I did!  I tried both of these, and simply aligning and
letting transparent hugepages do the work seemed easier.  If you
prefer mmap + madvise I'll submit a patch that does that instead.

Both ways solve the problem of needing special permissions.

> On Solaris we do kind of the 
> same thing, but there you have to do mmap + memcntl(MC_HAT_ADVISE). 
> Although Solaris 10 also supports out-of-the-box large pages, so in 
> theory you don't have to do anything, but I guess it's always better to 
> hint the OS that you really want it.

OK.

Andrew.


More information about the hotspot-dev mailing list