0

Let's say I mount hugepages at /mnt/hugepages; and then two applications open() and then mmap() to the same hugepage.

After one crashes, another close() and then munmap(), I noticed the hugepage is still allocated inside /mnt/hugepages, numastat -vm also shows that a hugepage is occupied. Then, I manually delete that file (/hugepage), numastat -vm still shows a hugepage is occupied. Then, I killed the remaining application. Finally, numastat -vm shows the hugepage is no longer occupied.

Now my question is what is the proper way to release the hugepage in this case without killing all the applications previously mmap-ed the page?

I did read this post.

But my post is different that I don't want to kill all the applications but release the hugepage asap and I don't want to unmount.

Thanks!

HCSF
  • 2,387
  • 1
  • 14
  • 40

1 Answers1

1

To delete files you need to unmap all mappings, close all file descriptors, and unlink all names.

You need to call unlink() on the file.

Timothy Baldwin
  • 3,551
  • 1
  • 14
  • 23