Linux中Huge Pages的相关设置有哪些

44次阅读
没有评论

共计 2696 个字符,预计需要花费 7 分钟才能阅读完成。

本篇内容介绍了“Linux 中 Huge Pages 的相关设置有哪些”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让丸趣 TV 小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

PostgreSQL 通过参数 huge_pages 设置是否启用大页,利用常驻内存用以提升性能

Check if CPU supports HugePages 2MB Size
命令如下,关键字是 pse(Page Size Extension)

[root@localhost ~]# cat /proc/cpuinfo | grep pse | uniq
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase smep arat
[root@localhost ~]# 
[root@localhost ~]#cat /proc/cpuinfo | egrep -o pse | head -n 1
[root@localhost ~]#

Check if CPU supports HugePages 1GB Size
命令如下,关键字是 pdpe1gb

[root@localhost ~]# grep pdpe1gb /proc/cpuinfo | head -n 1
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm fsgsbase smep arat
[root@localhost ~]# 
[root@localhost ~]# egrep -o pdpe1gb /proc/cpuinfo | head -n 1
pdpe1gb
[root@localhost ~]#

How to change default HugePage size?
默认大小为 2MB

[root@localhost ~]# grep Hugepagesize: /proc/meminfo
Hugepagesize: 2048 kB
[root@localhost ~]#

修改命令为

[root@localhost ~]# grep GRUB_CMDLINE_LINUX /etc/sysconfig/grub
GRUB_CMDLINE_LINUX= crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet 
[root@localhost ~]# 
[root@localhost ~]# vim /etc/sysconfig/grub
[root@localhost ~]# grep GRUB_CMDLINE_LINUX /etc/sysconfig/grub
GRUB_CMDLINE_LINUX= crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet default_hugepagesz=1G 
[root@localhost ~]# 
[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.2.14-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-5.2.14-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-957.27.2.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-957.27.2.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-f0b4bffdc9e44816abd201320f8a4f75
Found initrd image: /boot/initramfs-0-rescue-f0b4bffdc9e44816abd201320f8a4f75.img
[root@localhost ~]# 
[root@localhost ~]# reboot
Connection closed by foreign host.
[root@localhost ~]# grep Hugepagesize /proc/meminfo
Hugepagesize: 1048576 kB
[root@localhost ~]#

“Linux 中 Huge Pages 的相关设置有哪些”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注丸趣 TV 网站,丸趣 TV 小编将为大家输出更多高质量的实用文章!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-26发表,共计2696字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)