In hugemmap04, the huge page size was defined as a macro-definition.
#define HUGE_PAGE ((1UL) << 20) /* Huge page size */ */
However different architecture may has different huge page size in kernel. Such as :
1. http://lxr.linux.no/linux/include/asm-i386/page.h#L122
#define HPAGE_SHIFT 22
#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) // the size is 4M
2. http://lxr.linux.no/linux/include/asm-parisc/page.h#L160
#define HPAGE_SHIFT 22 /* 4MB (is this fixed?) */
#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
3. PPC: 16M
So reading the huge page size from the kernel parameters is more precise to this test case. The solution is to get the huge page size from the /proc/meminfo. Signed-off-by: Jin Bing Guo <guojb@cn.ibm.com>.
1 file changed