ITPub博客

首页 > 应用开发 > IT综合 > HugeTLBfs

HugeTLBfs

原创 IT综合 作者:xueji03 时间:2008-08-20 10:43:41 0 删除 编辑
The CPU’s Translation Lookaside Buffer (TLB) is a small cache used for storing virtual-tophysical mapping information. By using the TLB, a translation can be performed without referencing the in-memory page table entry that maps the virtual address. However, to keep
translations as fast as possible, the TLB is usually small. It is not uncommon for large memory applications to exceed the mapping capacity of the TLB.[@more@]

在2.6的kernel里对这个值 的评价是这样的:

This memory management feature is valuable for applications that use a large virtual address space. It is especially useful for database applications.然后在网上找到一个脚本用于找出当前系统的HugeTLB推荐值,如下:

#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
#
# Note: This script does calculation for all shared memory
# segments available when the script is run, no matter it
# is an Oracle RDBMS shared memory segment or not.

# Check for the kernel version
KERN=`uname -r | awk -F. '{ printf("%d.%dn",$1,$2); }'`

# Find out the HugePage size
HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`

# Start from 1 pages to be on the safe side and guarantee 1 free HugePage
NUM_PG=1

# Cumulative number of pages required to handle the running shared memory segments
for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
do
MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
if [ $MIN_PG -gt 0 ]; then
NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
fi
done

# Finish with results
case $KERN in
'2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
*) echo "Unrecognized kernel version $KERN. Exiting." ;;
esac

# End

另外,找到一篇不错文章供参考:
http://people.valinux.co.jp/~taka/hpageremap.html

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14517718/viewspace-1009198/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: Procedure加密
请登录后发表评论 登录
全部评论

注册时间:2008-07-01

  • 博文量
    16
  • 访问量
    38076