Created
December 20, 2013 02:29
-
-
Save chiangbing/8049624 to your computer and use it in GitHub Desktop.
an example to configure huge page on centos (from willis)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tlbuser=clay | |
totalgb=$(( 32*1024*1024*1024 )) | |
pgsize=$(( 2048*1024 )) | |
sysctl=/etc/sysctl.conf | |
limits=/etc/security/limits.conf | |
configured=`grep kernel.shmmax $sysctl` | |
if [ -n "$configured" ]; then | |
echo 'hugepage is configured' | |
exit | |
else | |
echo "kernel.shmmax=$totalgb" >> $sysctl | |
echo "vm.nr_hugepages=$(( $totalgb/$pgsize ))" >> $sysctl | |
echo "vm.hugetlb_shm_group=`grep $tlbuser /etc/group | tr ':' ' ' | awk '{print $3}'`" >> $sysctl | |
echo "$tlbuser soft memlock $(( $totalgb/1024 ))" >> $limits | |
echo "$tlbuser hard memlock $(( $totalgb/1024 ))" >> $limits | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment