Skip to content

Instantly share code, notes, and snippets.

@chiangbing
Created December 20, 2013 02:29
Show Gist options
  • Save chiangbing/8049624 to your computer and use it in GitHub Desktop.
Save chiangbing/8049624 to your computer and use it in GitHub Desktop.
an example to configure huge page on centos (from willis)
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