Support huge pages on old Linux kernels

Andrew Haley aph at
Wed Jun 8 07:56:32 PDT 2011

On 06/08/2011 02:13 PM, Dr Andrew John Hughes wrote:
> On 17:33 Fri 03 Jun     , Andrew Haley wrote:
>> This is a patch that allows huge pages to be used more easily on older
>> kernels that don't have MAP_HUGETLB.  The idea is that you create a
>> filesystem of type hugetlbfs like so:
>> # mount -t hugetlbfs -o gid=aph,mode=0700 none /mnt/huge
>> And create some huge pages:
>> # echo 1024 > /proc/sys/vm/nr_hugepages
>> Java then searches for a huge page mount point and if one exists
>> uses it to create mappings.
>> I'm not sure how generally useful this is.  For systems with long-
>> term support such as Red Hat Enterprise Linux this makes sense, but
>> are there any distros where this might be useful?  I don't really want
>> to push this upstream with a bunch of #defines or probes to test the
>> OS's capability: that code is complicated enough already.
> Does this still work as before on systems with MAP_HUGETLB?  The
> patch seems to be removing a bunch of existing code rather than just
> adding a fallback.

That's right.  The huge page code is complicated enough as it is, and
I don't want to end up with three versions in the same binary, testing
one, then the next, then the next: that would be even worse than a
bunch of #ifdefs.  It makes sense to do that where you have a single
binary that runs on many systems, but not on GNU/Linux distributions,
where you know that a single binary will be run on only one system.  I
wouldn't expect this patch to be used anywhere but long-term support


More information about the distro-pkg-dev mailing list