11#! /bin/bash
22
33# Script for setting up hugetlbfs pages & mounts.
4- # By default allocates 128 of 2 MiB hugepages and 0 of 1 GiB hugepages.
4+ # By default allocates 128 of 2 MiB hugepages and 6 of 1 GiB hugepages.
55# Defaults can be altered by configuration files containing an integer (see variables HUGEPAGES_XX_CONF for paths).
66
77
8- HUGEPAGES_2M_CONF=" /etc/flpprototype .d/hugepages-2MiB.conf"
9- HUGEPAGES_2M_SYSFILE=" /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages"
8+ HUGEPAGES_2M_CONF=/etc/flp .d/readoutcard/ hugepages-2MiB.conf
9+ HUGEPAGES_2M_SYSFILE=/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
1010HUGEPAGES_2M_NUMBER=128
11- HUGEPAGES_1G_CONF=" /etc/flpprototype .d/hugepages-1GiB.conf"
12- HUGEPAGES_1G_SYSFILE=" /sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages"
13- HUGEPAGES_1G_NUMBER=0
11+ HUGEPAGES_1G_CONF=/etc/flp .d/readoutcard/ hugepages-1GiB.conf
12+ HUGEPAGES_1G_SYSFILE=/sys/kernel/mm/hugepages/hugepages-1048576kB/nr_hugepages
13+ HUGEPAGES_1G_NUMBER=6
1414
1515
1616# Allocate hugepages of each type
3232fi
3333echo $HUGEPAGES_1G_NUMBER > $HUGEPAGES_1G_SYSFILE
3434
35-
36- # Add group for PDA
37- # This group will be allowed to do PCI things with the driver, and create files in the hugetlbfs mounts
38- echo " Adding 'pda' group"
39- groupadd --force pda
40-
41-
4235# Create hugetlbfs mounts in /var/lib/hugetlbfs/global/...
4336echo " Creating hugetlbfs mounts"
4437hugeadm --create-global-mounts
4538echo " Setting permissions on hugeltbfs mounts"
4639chgrp -R pda /var/lib/hugetlbfs/global/*
4740chmod -R g+rwx /var/lib/hugetlbfs/global/*
4841
49-
5042# Display hugepage status
5143echo " "
5244echo " Hugepages:"
@@ -55,4 +47,4 @@ echo ""
5547echo " Use 'echo [number] > /sys/kernel/mm/hugepages/hugepages-[size]/nr_hugepages' to allocate hugepages manually"
5648echo " Or set a number in the following conf files and run the script again:"
5749echo " echo [number] > $HUGEPAGES_2M_CONF "
58- echo " echo [number] > $HUGEPAGES_1G_CONF "
50+ echo " echo [number] > $HUGEPAGES_1G_CONF "
0 commit comments