In hugemmap01, huge page size was defined as a macro-definition.
#define page_sz ((1UL) << 24) /* 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 read the huge page size for the kernel parameters is reasonable. 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