I am getting the size of the large page size directly to my C code without running a base command.
I can do this with a bash
grep pse / proc / cpuinfo & gt; / Dev / null & amp; Amp; Echo '2M huge page sizes are supported' grep pdpe1gb / proc / cpuinfo & gt; / Dev / null & amp; Amp; '1g huge page size' is supported with 1g huge page size '' Second, how to use mmap with 1g huge page size?
Thank you
Update Snippet code
#include & lt; Stdio.h & gt; # Include & lt; Limits.h & gt; # Include & lt; Hugetlbfs.h & gt; Int main (zero) {long result 1 = friendly (); Printf ("% d \ n", result 1); Long result 2 = millinggewegesis (zero, 0); Printf ("% d \ n", result 2); Long result 3 = getpagesizes (zero, 0); Printf ("% d \ n", result 3); Printf ("% d \ n", PF_LINUX_HUGETLB); Return 0; } Output 20 9 7152 1 2 1048576 gethugepagesize return here What about the 2 GB 1 GB huge page?
Try it out.
Add # & lt; Hugetlbfs.h & gt; Int getpagesizes (long pages [], int n_elem);
No comments:
Post a Comment