• Dmitry Safonov's avatar
    ppc64/aarch64: Dynamically define PAGE_SIZE · 2d965008
    Dmitry Safonov authored
    On ppc64/aarch64 Linux can be set to use Large pages, so the PAGE_SIZE
    isn't build-time constant anymore. Define it through _SC_PAGESIZE.
    
    There are different sizes for a page on ppc64:
    : #if defined(CONFIG_PPC_256K_PAGES)
    : #define PAGE_SHIFT              18
    : #elif defined(CONFIG_PPC_64K_PAGES)
    : #define PAGE_SHIFT              16
    : #elif defined(CONFIG_PPC_16K_PAGES)
    : #define PAGE_SHIFT              14
    : #else
    : #define PAGE_SHIFT              12
    : #endif
    
    And on aarch64 there are default sizes and possibly someone can set his
    own PAGE_SHIFT:
    : config ARM64_PAGE_SHIFT
    :         int
    :         default 16 if ARM64_64K_PAGES
    :         default 14 if ARM64_16K_PAGES
    :         default 12
    
    On the downside - each time we need PAGE_SIZE, we're doing libc
    function call on aarch64/ppc64.
    
    Fixes: #415
    Tested-by: 's avatarAdrian Reber <areber@redhat.com>
    Signed-off-by: 's avatarDmitry Safonov <dima@arista.com>
    Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
    2d965008
page.h 980 Bytes