关于Linux的透明大页详细介绍
透明大页介绍
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
您可能感兴趣的文章
- 05-10Ubuntu系统安装ANSYS2021R1
- 05-10ANSYS2021R1安装方法Linux centos Ubuntu系统
- 11-07Linux中一对多配置日志服务器的详细步骤
- 11-07linux服务器安装SonarQube代码检测工具的详细步骤
- 11-07Apache自带的ab压力测试工具的实现
- 11-07apache虚拟主机配置的三种方式(小结)
- 11-07Linux在两个服务器直接传文件的操作方法
- 11-07xshell5使用ssh连接阿里云服务器的实现步骤
- 11-07linux查看服务器开放的端口和启用的端口多种方式
- 11-07Xshell连接centOS7并与CentOS7联网