[RFC] Using large pages for large hash tables
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 17 10:22:47 PDT 2016
----- Original Message -----
> From: "Hal Finkel via llvm-commits" <llvm-commits at lists.llvm.org>
> To: "Michael Kruse" <llvm-commits at meinersbur.de>
> Cc: "Aaron Ballman" <aaron.ballman at gmail.com>, "llvm-commits" <llvm-commits at lists.llvm.org>
> Sent: Monday, October 17, 2016 12:14:54 PM
> Subject: Re: [RFC] Using large pages for large hash tables
>
> ----- Original Message -----
> > From: "Michael Kruse via llvm-commits"
> > <llvm-commits at lists.llvm.org>
> > To: "Rafael EspĂndola" <rafael.espindola at gmail.com>
> > Cc: "Aaron Ballman" <aaron.ballman at gmail.com>, "llvm-commits"
> > <llvm-commits at lists.llvm.org>
> > Sent: Monday, October 17, 2016 10:49:29 AM
> > Subject: Re: [RFC] Using large pages for large hash tables
> >
> > 2016-10-17 17:38 GMT+02:00 Rafael EspĂndola via llvm-commits
> > <llvm-commits at lists.llvm.org>:
> > > I did a quick and dirty experiment to use large pages when a hash
> > > table gets big. The results for lld are pretty impressive (see
> > > attached file, but basically 1.04X faster link of files with
> > > debug
> > > info).
> > >
> > > I tested disabling madvise and the performance goes back to what
> > > it
> > > was, so it is really the large pages that improves the
> > > performance.
> > >
> > > The main question is then what the interface should look like. On
> > > linux the abstraction could be
> > >
> > > std::pair<void *, size_t> mallocLarge(size_t Size);
> > >
> > > which return the allocated memory and how much was actually
> > > allocated.
> > > The pointer can be passed to free once it is no longer needed.
> > >
> > > The fallback implementation just calls malloc and returns Size
> > > unmodified.
> > >
> > > On linux x86_64 if size is larger than 2MiB we use posix_memalign
> > > and madvise.
> > >
> > > Would the same interface work on windows?
> >
> > Yes, using VirtualAlloc using MEM_LARGE_PAGES flag:
> > https://msdn.microsoft.com/fr-fr/library/windows/desktop/aa366887(v=vs.85).aspx
> >
> > Size can be determined using GetLargePageMinimum(), or a multiple
> > of
> > it.
> >
> > Do common implementations of malloc allocate (large) pages
> > automatically when the allocated size is large enough?
>
> No :(
I'll add, however, that sometimes you get them if you have transparent huge pages enabled.
-Hal
>
> -Hal
>
> >
> > Michael
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
>
> --
> Hal Finkel
> Lead, Compiler Technology and Programming Languages
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list