Script to configure HugePages in Linux

 

 

Sometimes you have just finished the installation of the operating system (OEL in our case) and you want to configure the hugepages for the SGA of Oracle.

 

Here you can see one script to configure the 80% from the total memory in the machine (you can change this percentage if you want).

 

* Attention! –> You need to be sure that nothing more is running in your machine because if you have one Oracle Database you need to run this other script “Oracle Linux: Shell Script to Calculate
Values Recommended Linux HugePages / HugeTLB Configuration (Doc ID 401749.1)

 

If you want to modify the percentage (80%) you can do it in the line “pags=” and changing the 80 number for another value.

 

Execute it:

[root@nodo01 ~]# /tmp/config_hugepages80.sh
32767 GB VmallocTotal: 34359738367 kB
39 GB MemTotal: 41186732 kB
34 GB DirectMap1G: 35651584 kB
28 GB HugePages_Total: 14416
28 GB HugePages_Free: 14416
10 GB MemAvailable: 10550832 kB
9 GB CommitLimit: 10025680 kB
7 GB MemFree: 7384284 kB
6 GB DirectMap2M: 7243776 kB
3 GB SwapTotal: 4194300 kB
3 GB SwapFree: 4194300 kB
3 GB Cached: 3452204 kB
1 GB Inactive(file): 1995756 kB
1 GB Inactive: 2011316 kB
1 GB Active(file): 1446100 kB
1 GB Active: 1462444 kB
0 GB SUnreclaim: 82040 kB
0 GB SReclaimable: 122556 kB
0 GB Slab: 204596 kB
0 GB Shmem: 16960 kB
0 GB PageTables: 2228 kB
0 GB Mapped: 33532 kB
0 GB KernelStack: 3696 kB
0 GB Inactive(anon): 15560 kB
0 GB HugePages_Surp: 0
0 GB HugePages_Rsvd: 0
0 GB Hugepagesize: 2048 kB
0 GB Dirty: 4 kB
0 GB DirectMap4k: 96256 kB
0 GB Committed_AS: 126564 kB
0 GB Buffers: 6608 kB
0 GB AnonPages: 15044 kB
0 GB Active(anon): 16344 kB

 

Don’t forget to reboot the system and check the modified values!

 

  • The awk for seeing the hugepages is courtesy from Franck Pachot: https://twitter.com/FranckPachot/status/1083023727460343808?s=19

 

Adding value with Arumel!!

%d bloggers like this: