透明大页介绍

Transparent Huge Pages的一些官方介绍资料:

Transparent Huge Pages (THP) are enabled by default in RHEL 6 for all applications. The kernel attempts to allocate hugepages whenever possible and any Linux process will receive 2MB pages if the mmap region is 2MB naturally aligned. The main kernel address space itself is mapped with hugepages, reducing TLB pressure from kernel code. For general information on Hugepages, see: What are Huge Pages and what are the advantages of using them?

The kernel will always attempt to satisfy a memory allocation using hugepages. If no hugepages are available (due to non availability of physically continuous memory for example) the kernel will fall back to the regular 4KB pages. THP are also swappable (unlike hugetlbfs). This is achieved by breaking the huge page to smaller 4KB pages, which are then swapped out normally.

But to use hugepages effectively, the kernel must find physically continuous areas of memory big enough to satisfy the request, and also properly aligned. For this, a khugepaged kernel thread has been added. This thread will occasionally attempt to substitute smaller pages being used currently with a hugepage allocation, thus maximizing THP usage.

In userland, no modifications to the applications are necessary (hence transparent). But there are ways to optimize its use. For applications that want to use hugepages, use of posix_memalign() can also help ensure that large allocations are aligned to huge page (2MB) boundaries.

Also, THP is only enabled for anonymous memory regions. There are plans to add support for tmpfs and page cache. THP tunables are found in the /sys tree under /sys/kernel/mm/redhat_transparent_hugepage.

 

查看是否启用透明大页

1:命令cat /sys/kernel/mm/redhat_transparent_hugepage/enabled 该命令适用于Red Hat Enterprise Linux系统

[root@getlnx06 ~]# more /etc/issue
 
Red Hat Enterprise Linux Server release 6.6 (Santiago)
 
Kernel \r on an \m
 
[root@getlnx06 ~]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
 
[always] madvise never

 

2:命令cat /sys/kernel/mm/transparent_hugepage/enabled 该命令适用于其它Linux系统

[root@getlnx06 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
 
always madvise [never]
 
[root@getlnx06 ~]# 

使用命令查看时,如果输出结果为[always]表示透明大页启用了。[never]表示透明大页禁用、[madvise]表示

 

3:如何HugePages_Total返回0,也意味着透明大页禁用了

[root@getlnx06 ~]# grep -i HugePages_Total /proc/meminfo 
 
HugePages_Total: 0

 

4:cat /proc/sys/vm/nr_hugepages返回0也意味着透明大页禁用了。

[root@getlnx06 ~]# cat /proc/sys/vm/nr_hugepages 
 
0

 

禁用、启用透明大页功能

 

方法1:设置/etc/grub.conf文件,在系统启动是禁用。

[root@getlnx06 ~]# vi /etc/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup--LogVol0-LogVol01
#          initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-504.el6.x86_64 ro root=/dev/mapper/VolGroup--LogVol0-LogVol01 rd_NO_LUKS LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=VolGroup-LogVol0/LogVol01 rd_LVM_LV=VolGroup-LogVol0/LogVol00  KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
        initrd /initramfs-2.6.32-504.el6.x86_64.img
transparent_hugepage=never

clip_image001

 

方法2:设置/etc/rc.local文件

[root@getlnx06 ~]# vi /etc/rc.local
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
 
touch /var/lock/subsys/local
 
if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then
   echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
fi

clip_image002

 

使用上面的配置后必须重启操作系统才能生效,你也可以运行下面命令不用重启操作系统。

You must reboot your system for the setting to take effect, or run the following two echo lines to proceed with the install without rebooting:

[root@getlnx06 ~]# echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled
[root@getlnx06 ~]# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
always madvise [never]
[root@getlnx06 ~]# 

 

小知识点:

1:从RedHat 6, OEL 6, SLES 11 and UEK2 kernels 开始,系统缺省会启用 Transparent HugePages :用来提高内存管理的性能透明大页(Transparent HugePages )和之前版本中的大页功能上类似。主要的区别是:Transparent HugePages 可以实时配置,不需要重启才能生效配置;

 

2:Transparent Huge Pages在32位的RHEL 6中是不支持的。

Transparent Huge Pages are not available on the 32-bit version of RHEL 6.

 

3: ORACLE官方不建议我们使用RedHat 6, OEL 6, SLES 11 and UEK2 kernels 时的开启透明大页(Transparent HugePages ), 因为透明大页(Transparent HugePages ) 存在一些问题:

        1.在RAC环境下 透明大页(Transparent HugePages )会导致异常节点重启,和性能问题;

        2.在单机环境中,透明大页(Transparent HugePages ) 也会导致一些异常的性能问题;

Transparent HugePages memory is enabled by default with Red Hat Enterprise Linux 6, SUSE Linux Enterprise Server 11, and Oracle Linux 6 with earlier releases of Oracle Linux Unbreakable Enterprise Kernel 2 (UEK2) kernels. Transparent HugePages memory is disabled in later releases of Oracle Linux UEK2 kernels.Transparent HugePages can cause memory allocation delays during runtime. To avoid performance issues, Oracle recommends that you disable Transparent HugePages on all Oracle Database servers. Oracle recommends that you instead use standard HugePages for enhanced performance.Transparent HugePages memory differs from standard HugePages memory because the kernel khugepaged thread allocates memory dynamically during runtime. Standard HugePages memory is pre-allocated at startup, and does not change during runtime.

Starting with RedHat 6, OEL 6, SLES 11 and UEK2 kernels, Transparent HugePages are implemented and enabled (default) in an attempt to improve the memory management. Transparent HugePages are similar to the HugePages that have been available in previous Linux releases. The main difference is that the Transparent HugePages are set up dynamically at run time by the khugepaged thread in kernel while the regular HugePages had to be preallocated at the boot up time. Because Transparent HugePages are known to cause unexpected node reboots and performance problems with RAC, Oracle strongly advises to disable the use of Transparent HugePages. In addition, Transparent Hugepages may cause problems even in a single-instance database environment with unexpected performance problems or delays. As such, Oracle recommends disabling Transparent HugePages on all Database servers running Oracle.

 

4:安装Vertica Analytic Database时也必须关闭透明大页功能。

 

参考资料:

https://access.redhat.com/solutions/46111

http://www.soso.io/article/65143.html

  • 2
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 云南茶山位于云南省曲靖市宣威市,东西跨江,北接滇池,南接大理市,是云南省茶叶的发源地,是中国著名的茶叶之乡。茶山原名叫茶城,古时候有“三茶一石”之称,即茶山、茶城两座山,加上一块大石,因此得名。茶山以其独特的茶文化、历史文化和自然风景吸引着海内外游客,是一个具有浓郁的茶文化气息的绿色旅游景点。茶山以它的深厚的文化底蕴、美丽的自然风光和独特的民族风情深受游客的喜爱。茶山的风景独特,是一个绿色的森林公园,有空旷的茶园、茶山、茶山湖、茶厂、民居和古迹等,是云南省最大的茶叶生产基地。茶山有众多的历史文物,如景福寺、海拔殿、滇池殿、山西院等,历史悠久,非常值得一游。茶山也是云南省茶叶的发源地,以其独特的茶文化、历史文化和自然风景吸引着海内外游客,是一个具有浓郁的茶文化气息的绿色旅游景点。茶山还有著名的山茶花,每年的三月份到五月份是山茶花的盛开期,是观赏山茶花的最佳时机,可以看到满山遍野的山茶花,芳香四溢,令人流连忘返。茶山是一个具有独特风景和茶文化的绿色旅游胜地,可以让游客领略到古朴的茶文化,给游客留下深刻的印象。 ### 回答2: 云南茶山位于中国云南省西双版纳傣族自治州勐海县,是中国最著名的茶叶产区之一。云南茶山是云南丰富优质茶叶资源的核心地带,茶园分布在海拔1400米至1800米的山坡上,土壤肥沃,气候温暖湿润,适宜茶树生长。茶山遍布云贵高原的低海拔山地,地形起伏多变,形成了独特的茶树生态。 云南茶山以菜籽油树林下茶园为特色,这种种植模式具有独特的生态优势,能够充分利用土壤、气候和生态环境资源,为茶树提供了良好的生长环境。而菜籽油树林也可以提供树荫,保护茶树不受强光直射,并减少土壤水分的蒸发,提高茶叶品质。 云南茶山以普洱茶为代表,普洱茶是中国六大茶类之一,有着悠久的历史和独特的工艺。普洱茶的采摘、制作、贮存和饮用都有严格的要求和程序。其茶树品种主要有大叶种和中小叶种,茶叶形状多样,有饼茶、沱茶、砖茶、散茶等。普洱茶口感醇厚,香气独特,有降脂减肥、抗氧化、降压、提神醒脑等功效,深受茶叶爱好者的喜爱。 除了普洱茶,云南茶山还产出其他优质茶叶,如滇红茶、云南白草茶、黑兔毛茶等。这些茶叶在国内外市场上都有着较高的知名度和需求量。 云南茶山的旅游资源也十分丰富,茶山风光如画,茶园群山环抱,绿意盎然,吸引了大批游客前来观光和品茶。旅游者可以在茶园中亲自体验采茶和制茶的过程,了解茶叶的生产工艺和茶文化。同时,云南茶山还有许多古茶树群落,这些具有几百年甚至千年以上历史的茶树古树,是茶叶品质的保证,也是茶文化的重要组成部分。 综上所述,云南茶山作为中国茶叶产区之一,以其独特的生态环境和种植模式,优质的茶叶品种和精湛的制作工艺,以及丰富多样的旅游资源,成为茶叶爱好者和游客们不可错过的地方。云南茶山的产茶历史悠久,是中国茶文化的重要组成部分,也是云南省重要的农业和旅游产业之一。 ### 回答3: 云南茶山位于中国云南省西南部地区,是中国著名的茶叶产区之一。茶山地区地势起伏,气候多样,土壤肥沃,是茶叶生长的理想环境。 云南茶山的主要茶叶品种有普洱茶、滇红茶、云南绿茶等。普洱茶以其特殊的发酵制造技艺而闻名,色泽红润,滋味浓郁,具有良好的陈化潜力。滇红茶则为红茶中的代表,茶叶呈现红褐色,滋味醇厚,带有果香和花香气息。云南绿茶则以其嫩绿的外观、清香的口感和鲜爽的回甘赢得了众多茶叶爱好者的喜爱。 云南茶山的茶叶种植历史悠久,可以追溯到公元前2世纪左右。受益于云南独特的地理环境和气候条件,在此地茶树的生长速度较快,茶叶的品质也非常优良。茶山地区的高海拔和丰富的降水量为茶树提供了充足的水源,而茶园周围的山脉则保护了茶叶的生长环境,使其不受污染。 茶山的茶叶栽种以手工采摘为主,采摘过程中只选择嫩叶,以确保茶叶的质量和口感。采摘后的茶叶经过日光萎凋、揉捻、发酵、干燥等工序后,最终成为优质的茶叶产品。 云南茶山的茶叶不仅在国内畅销,也出口到世界各地。当地的茶叶产业为当地农民提供了就业机会和增加收入的途径,对地方经济的发展有着积极的影响。 总之,云南茶山凭借其独特的生态环境和理想的气候条件,生产出了许多优质的茶叶品种。这些茶叶不仅具有浓郁的香气和独特的口感,还具有丰富的营养成分。云南茶山的茶叶产业在国内外市场上受到了广泛的认可和青睐。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值