Skip to content

Commit

Permalink
ld.hugetlbfs: support 512M hugepages on aarch64
Browse files Browse the repository at this point in the history
aarch64 supports multiple hugepage sizes, if default is 512M,
then all linkhuge_rw tests segfault. This patch detects
default huge page size from /proc/meminfo output, rather than
using hardcoded value of 2M.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Eric B Munson <emunson@mgebm.net>
  • Loading branch information
jstancek authored and khers committed Feb 16, 2017
1 parent b944192 commit ff12744
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ld.hugetlbfs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ elf32ppclinux|elf64ppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
elf64lppc) HPAGE_SIZE=$((16*$MB)) SLICE_SIZE=$((256*$MB)) ;;
elf_i386|elf_x86_64) HPAGE_SIZE=$((4*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
elf_s390|elf64_s390) HPAGE_SIZE=$((1*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
armelf*_linux_eabi|aarch64elf*|aarch64linux*) HPAGE_SIZE=$((2*$MB)) SLICE_SIZE=$HPAGE_SIZE ;;
armelf*_linux_eabi|aarch64elf*|aarch64linux*)
hpage_kb=$(cat /proc/meminfo | grep Hugepagesize: | awk '{print $2}')
HPAGE_SIZE=$((hpage_kb * 1024))
SLICE_SIZE=$HPAGE_SIZE ;;
esac

if [ "$HTLB_ALIGN" == "slice" ]; then
Expand All @@ -119,7 +122,7 @@ if [ "$HTLB_ALIGN" == "slice" ]; then
# targeting the ARM platform one needs to explicitly set the text segment offset
# otherwise it will be NULL.
case "$EMU" in
armelf*_linux_eabi) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;;
armelf*_linux_eabi|aarch64elf*|aarch64linux*) HTLBOPTS="$HTLBOPTS -Ttext-segment=$SLICE_SIZE" ;;
elf_i386) HTLBOPTS="$HTLBOPTS -Ttext-segment=0x08000000" ;;
esac
fi
Expand Down

0 comments on commit ff12744

Please sign in to comment.