Skip to content

Check the default huge page size for Linux#425

Open
hankluo6 wants to merge 1 commit intomicrosoft:devfrom
hankluo6:huge_page
Open

Check the default huge page size for Linux#425
hankluo6 wants to merge 1 commit intomicrosoft:devfrom
hankluo6:huge_page

Conversation

@hankluo6
Copy link
Copy Markdown
Contributor

In Linux, we can read /proc/meminfo to get the huge page size.

Please node that this will get only one possible size, but Linux can supports more than one huge page size.

In Linux, we can read `/proc/meminfo` to get the huge page size.
@daanx
Copy link
Copy Markdown
Collaborator

daanx commented Oct 19, 2021

Thanks for the PR! and apologies for being so late addressing this :-(.
But yikes -- this is so fragile; very hesitant to include this ... it may be the only way to get the large page size though so perhaps it is what it is :-). I need to think a bit more on this.

@scottlamb
Copy link
Copy Markdown

I believe there's another interface that requires less parsing, described here:

Some userspace (such as a test program, or an optimized memory allocation library) may want to know the size (in bytes) of a PMD-mappable transparent hugepage:

cat /sys/kernel/mm/transparent_hugepage/hpage_pmd_size

On my system:

$ uname -a
Linux slamb-workstation 6.11.0-19-generic #19~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 17 11:51:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
$ cat /sys/kernel/mm/transparent_hugepage/hpage_pmd_size
2097152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants