Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to release hugepages from the crashed application

I have an application that uses hugepage and the application suddenly crashed due to some bug. After crashing, since the application does not release the hugepage properly, the free hugepage number is not increased in sys filesystem.

$ sudo cat /sys/kernel/mm/hugepages/hugepages-2048kB/free_hugepages 
0
$ sudo cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages 
1024

Is there a way to release the hugepages by force?

like image 984
jaeyong Avatar asked Dec 04 '13 03:12

jaeyong


People also ask

How do I enable HugePages in Linux?

Open the /etc/sysctl. conf file with root permissions and add the line to it manually. Reboot for these changes to take effect. Once again, check your system's allocation of huge pages in the /proc/meminfo virtual file.


1 Answers

Sometimes need to check all directory that hugetlbfs has been mounted. So,

  1. find mounted directory by command mount | grep huge.

  2. check every directory except especially /dev/hugepages.

  3. delete all 2M-sized files. (2M is the size of hugepage)

like image 180
ptan Avatar answered Sep 28 '22 05:09

ptan