欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Linux關(guān)于透明大頁(yè)機(jī)制的介紹

 更新時(shí)間:2022年02月23日 17:00:41   作者:瀟湘隱者  
這篇文章介紹了Linux中的透明大頁(yè)機(jī)制,對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧

透明大頁(yè)介紹

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.

查看是否啟用透明大頁(yè)

1:命令cat /sys/kernel/mm/redhat_transparent_hugepage/enabled 該命令適用于Red Hat Enterprise Linux系統(tǒng)

[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系統(tǒng)

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

使用命令查看時(shí),如果輸出結(jié)果為[always]表示透明大頁(yè)啟用了。[never]表示透明大頁(yè)禁用、[madvise]表示(只在MADV_HUGEPAGE標(biāo)志的VMA中使用THP

3:如何HugePages_Total返回0,也意味著標(biāo)準(zhǔn)大頁(yè)禁用了(注意傳統(tǒng)/標(biāo)準(zhǔn)大頁(yè)和透明大頁(yè)的區(qū)別)

透明大頁(yè)(THP)管理和標(biāo)準(zhǔn)/傳統(tǒng)大頁(yè)(HP)管理都是操作系統(tǒng)為了減少頁(yè)表轉(zhuǎn)換消耗的資源而發(fā)布的新特性,雖然ORACLE建議利用大頁(yè)機(jī)制來提高數(shù)據(jù)庫(kù)的性能,但是ORACLE卻同時(shí)建議關(guān)閉透明大頁(yè)管理。這二者的區(qū)別在于大頁(yè)的分配機(jī)制,標(biāo)準(zhǔn)大頁(yè)管理是預(yù)分配的方式,而透明大頁(yè)管理則是動(dòng)態(tài)分配的方式。

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

4:cat /proc/sys/vm/nr_hugepages返回0也意味著傳統(tǒng)大頁(yè)禁用了(傳統(tǒng)大頁(yè)和透明大頁(yè))。

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

禁用、啟用透明大頁(yè)功能

方法1:設(shè)置/etc/grub.conf文件,在系統(tǒng)啟動(dòng)是禁用。

[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

方法2:設(shè)置/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

使用上面的配置后必須重啟操作系統(tǒng)才能生效,你也可以運(yùn)行下面命令不用重啟操作系統(tǒng)。

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 ~]# 

小知識(shí)點(diǎn):

1:從RedHat 6, OEL 6, SLES 11 and UEK2 kernels 開始,系統(tǒng)缺省會(huì)啟用 Transparent HugePages :用來提高內(nèi)存管理的性能透明大頁(yè)(Transparent HugePages )和之前版本中的大頁(yè)功能上類似。主要的區(qū)別是:Transparent HugePages 可以實(shí)時(shí)配置,不需要重啟才能生效配置;

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 時(shí)的開啟透明大頁(yè)(Transparent HugePages ), 因?yàn)橥该鞔箜?yè)(Transparent HugePages ) 存在一些問題:

  • 1.在RAC環(huán)境下 透明大頁(yè)(Transparent HugePages )會(huì)導(dǎo)致異常節(jié)點(diǎn)重啟,和性能問題;
  • 2.在單機(jī)環(huán)境中,透明大頁(yè)(Transparent HugePages ) 也會(huì)導(dǎo)致一些異常的性能問題;

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時(shí)也必須關(guān)閉透明大頁(yè)功能。

到此這篇關(guān)于Linux關(guān)于透明大頁(yè)機(jī)制的文章就介紹到這了。希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 詳解Linux中如何安全地抹去磁盤數(shù)據(jù)

    詳解Linux中如何安全地抹去磁盤數(shù)據(jù)

    離過職的小伙伴都知道,離職的時(shí)候需要上交公司電腦,但是電腦里面有許多我們的個(gè)人信息,所以我們就需要先把這些信息都刪除,確保無法恢復(fù)之后才上交,下面我們來看一下在 Linux 中如何安全地抹去磁盤數(shù)據(jù)吧
    2023-10-10
  • Linux入侵常用命令之防黑客示例代碼

    Linux入侵常用命令之防黑客示例代碼

    這篇文章主要給大家介紹了關(guān)于Linux入侵常用命令之防黑客的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-05-05
  • apache虛擬主機(jī)配置的三種方式(小結(jié))

    apache虛擬主機(jī)配置的三種方式(小結(jié))

    本文主要介紹了apache虛擬主機(jī)配置的三種方式,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-07-07
  • linux_HDFS文件上傳后的追加報(bào)錯(cuò)問題

    linux_HDFS文件上傳后的追加報(bào)錯(cuò)問題

    這篇文章主要介紹了linux_HDFS文件上傳后的追加報(bào)錯(cuò)問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • Linux?Autofs自動(dòng)掛載服務(wù)安裝部署教程

    Linux?Autofs自動(dòng)掛載服務(wù)安裝部署教程

    大家好,本篇文章主要講的是Linux?Autofs自動(dòng)掛載服務(wù)安裝部署教程,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下哦
    2021-11-11
  • Linux采用雙網(wǎng)卡bond、起子接口的方式

    Linux采用雙網(wǎng)卡bond、起子接口的方式

    這篇文章主要給大家介紹了關(guān)于Linux采用雙網(wǎng)卡bond、起子接口的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-11-11
  • linux下make命令實(shí)現(xiàn)輸出高亮的方法

    linux下make命令實(shí)現(xiàn)輸出高亮的方法

    Linux 下 make 命令是系統(tǒng)管理員和程序員用的最頻繁的命令之一。管理員用它通過命令行來編譯和安裝很多開源的工具,程序員用它來管理他們大型復(fù)雜的項(xiàng)目編譯問題。這篇文章主要給大家介紹了關(guān)于linux下make命令實(shí)現(xiàn)輸出高亮的方法,需要的朋友可以參考下。
    2017-07-07
  • linux下查看so或可執(zhí)行程序的依賴庫(kù)

    linux下查看so或可執(zhí)行程序的依賴庫(kù)

    今天小編就為大家分享一篇關(guān)于linux下查看so或可執(zhí)行程序的依賴庫(kù),小編覺得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來看看吧
    2019-04-04
  • 解決nginx/apache靜態(tài)資源跨域訪問問題詳解

    解決nginx/apache靜態(tài)資源跨域訪問問題詳解

    有時(shí)為了優(yōu)化網(wǎng)站訪問速度,會(huì)給一些靜態(tài)資源配置cdn加速,但是有時(shí)候會(huì)出現(xiàn)跨域訪問的問題,在nginx和apache服務(wù)中可進(jìn)行如下配置
    2018-10-10
  • Centos8(最小化安裝)全新安裝Python3.8+pip的方法教程

    Centos8(最小化安裝)全新安裝Python3.8+pip的方法教程

    這篇文章主要介紹了Centos8(最小化安裝)全新安裝Python3.8+pip的方法教程,本文給大家整理了一份命令,需要的朋友可以參考下
    2020-02-02

最新評(píng)論