Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if a System V shared memory segment is backed by huge pages or regular pages

To allocate a System V shared memory segment, one can use shmget() with the SHM_HUGETLB flag.

Is there a way to check whether a System V shared memory segment is backed by huge pages or regular pages assuming that we do not know how the original creator of this memory segment used the shmget() system call.

like image 714
Shang Jian Ding Avatar asked Dec 06 '25 07:12

Shang Jian Ding


1 Answers

Ok, I think I figured it out.

One method is to attach to the shared memory segment (or rely on a process which is already attached), and examine /proc/[PID]/smaps to find the shared memory segment of interest and look at the corresponding KernelPageSize field to see it matches up with the server's configured Hugepagesize

like image 136
Shang Jian Ding Avatar answered Dec 07 '25 20:12

Shang Jian Ding



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!