Включение больших страниц на Linux

Включение больших страниц на Linux

#!/bin/bash
 
script=`basename "$0"`
HPS=`grep Hugepagesize /proc/meminfo | awk -F" " {'print $2'}`
NC=`grep -c processor /proc/cpuinfo`
NHP=$(($(($NC*2200/$HPS))+1))
case $@ in
 
        enable)
                echo $NHP > /proc/sys/vm/nr_hugepages
                ulimit -l $(($NHP * $HPS))
                echo "Huge pages enabled"
                ;;
 
        disable)
                echo 0 > /proc/sys/vm/nr_hugepages
                echo "Huge pages disabled"
                ;;
 
        *)
                echo -e "Usage: \n$script enable - Enabling Huge Pages\n$script disable - Disabling Huge Pages"
                ;;
 
esac