Get the page size

This page lists the different ways to get the kernel page size used in the device. To connect to the device, you can use adb.

$ adb shell

Use the getconf command

Use the getconf command to get the page size, shown as follows:

$ getconf PAGE_SIZE

Use the /proc/<pid>/smaps pseudo file

The KernelPageSize field in the pseudo file /proc/<pid>/smaps shows the page size, shown as follows:

$ grep KernelPageSize /proc/1/smaps
KernelPageSize:        4 kB

Use the LD_SHOW_AUXV=1 linker flag

Use the LD_SHOW_AUXV flag to print the auxiliary vector of the program that is about to be executed. The AT_PAGESZ field contains the page size, shown as follows:

AT_SYSINFO_EHDR      0x7250460000
AT_HWCAP             0b11111111111111111111111111111111
AT_PAGESZ            4096
AT_CLKTCK            100
AT_PHDR              0x5fda1e0040
AT_PHENT             56
AT_PHNUM             12
AT_BASE              0x72502f8000
AT_FLAGS             0
AT_ENTRY             0x5fda210000
AT_UID               0
AT_EUID              0
AT_GID               0
AT_EGID              0
AT_SECURE            0
AT_RANDOM            0x7fc59d66f8
AT_HWCAP2            0b100011001111111111
AT_EXECFN            "/system/bin/ls"
AT_PLATFORM          "aarch64"
data            dev.        init    vendor

Use the /proc/config.gz pseudo file

Check the kernel configuration for the page size in the pseudo file /proc/config.gz. The possible configurations for the page size are:

  • CONFIG_ARM64_4K_PAGES=y: the kernel uses 4096-byte pages.
  • CONFIG_ARM64_16K_PAGES=y: the kernel uses 16384-byte pages.
  • CONFIG_ARM64_64K_PAGES=y: the kernel uses 65536-byte pages.
$ zcat /proc/config.gz | grep "CONFIG_ARM64_[164K]*_PAGES=y"

Use the Auxiliary Vector

When a program is executed, the kernel allocates and initializes the auxiliary vector with information, such as the page size, that is used by the dynamic linker. The auxiliary vector can be read from the pseudo file /proc/<pid>/auxv. The page size from the auxiliary vector of process 1 can be shown as follows:

$ od -N8 -j56 -td8 -An /proc/1/auxv


  • od dumps files in hexadecimal, decimal or other formats.
  • -N8 -j56 dumps the 8 bytes starting at offset 56 into the file, corresponding to AT_PAGESZ.
  • -td8 formats the value as a decimal 8-byte integer.
  • -An causes just the value to be shown, not its address.