Jump to content

Toggle Hugepages Support Linux


Recommended Posts

Posted by HashVault: 

This script will allow you to turn huge page support on and off on Linux  

#!/usr/bin/env 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

 

  • Thanks 1

Snider - HashVault Support

Helpful Links: Official Android Monitoring App | Discord Server | Configure XMRig | Configure Proxy

Link to post
Share on other sites
  • 9 months later...

For those who don't know how to run the script:

1. Save it in some text editor (vim/nano/some gui editor) as "hugepages.sh" (for example)

2. Ensure that you have terminal in the same direction as the script (use cd to enter directories and cd .. to go back)

3. Run command "chmod +x hugepages.sh"

4. run "sudo ./hugepages.sh enable" to enable hugepages and "sudo ./hugepages.sh disable" to disable them 

  • Like 1

_______________
Wor3d
Hashvault [SK/CZ] Support Team

Don't forget to join our forum at hashvault.pro and join our Discord Server here.

Link to post
Share on other sites
×
×
  • Create New...