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
您可能感兴趣的文章
- 10-28Linux线程之线程的创建、属性、回收、退出、取消方式
- 10-28Linux下进程的CPU配置与线程绑定过程
- 10-28Linux进程CPU绑定优化与实践过程
- 10-28linux服务器查看进程、线程数量方式
- 10-28Linux下如何清理系统缓存并释放内存
- 10-28Linux如何解决kill进程失败问题
- 10-28CentOS系统下前后端项目部署的操作指南
- 10-28Linux gdb多进程、多线程调试过程
- 10-28Apache HTTP Server 从安装到配置过程详解
- 10-28Ubuntu 24.04启用root图形登录的操作流程


阅读排行
推荐教程
- 05-27Linux NFS服务器安装与配置思路分析
- 05-27阿里云linux服务器安全设置(防火墙策略等)
- 05-27Linux命令学习总结之rmdir命令
- 10-12Linux系统 Centos7.4手动在线升级到Centos7.7
- 05-27SecureCRT中文显示乱码问题的解决方法
- 11-07Linux搭建DHCP服务器的详细过程
- 05-10Ubuntu系统安装ANSYS2021R1
- 06-12linux系统SSL证书部署https单/多站点
- 05-10ANSYS2021R1安装方法Linux centos Ubuntu系统
- 05-27apache密码生成工具htpasswd使用详解


