How to Change the Memory Page Size from 64 KB to 4 KB on openEuler
The default page size of openEuler 20.03 series OSs (kernel version 4.19) is 64 KB. You can check the page size by running the getconf PAGESIZE command, and change the value based on service requirements. The modification method is as follows:
- Check the current memory page size.
getconf PAGESIZE
If 65536 is displayed in the command output, the page size is 64 KB.

- Obtain the kernel source code.
- Create a directory and access the directory.
mkdir -p /home/kernel-bcache cd /home/kernel-bcache
- Download the kernel source package to the /home/kernel-bcache directory.

- Decompress the source package.
rpm2cpio kernel-4.19.90-2109.1.0.0108.oe1.src.rpm | cpio -divm tar -zxvf kernel.tar.gz
- Configure an image repository.
- Download openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso.
- Use an SFTP tool to upload the openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso file to the /root directory on the server.
- Create a local directory to mount the image.
mkdir -p /iso
- Mount the ISO file to the local directory.
mount /root/openEuler-20.03-LTS-SP1-everything-aarch64-dvd.iso /iso
- Create a Yum repository for the image.
- Open the configuration file.
vi /etc/yum.repos.d/openEuler.repo
- Press i to enter the insert mode and add the following content to the file:
[Base] name=Base baseurl=file:///iso enabled=1 gpgcheck=0 priority=1 [openEuler-source] name=openEuler-source baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/source/RPM-GPG-KEY-openEuler [openEuler-os] name=openEuler-os baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/aarch64/ enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/OS/aarch64/RPM-GPG-KEY-openEuler [openEuler-everything] name=openEuler-everything baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/aarch64/ enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/everything/aarch64/RPM-GPG-KEY-openEuler [openEuler-EPOL] name=openEuler-epol baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/EPOL/aarch64/ enabled=1 gpgcheck=0 [openEuler-update] name=openEuler-update baseurl=http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/aarch64/ enabled=1 gpgcheck=0
- Press Esc to exit the insert mode. Input :wq! and press Enter to save the file and exit.
- Open the configuration file.
- Install the dependencies.
dnf -y install ncurses-devel bison m4 flex rpm-build rpmdevtools asciidoc audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel gtk2-devel java-1.8.0-openjdk-devel xz-devel libbabeltrace-devel libunwind-devel newt-devel numactl-devel openssl-devel pciutils-devel perl-generators python3-devel python3-docutils xmlto zlib-devel createrepo genisoimage
- Create a directory and access the directory.
- Modify the kernel configuration file.
1 2 3
cd /home/kernel-bcache/kernel cp arch/arm64/configs/openeuler_defconfig .config make menuconfig
- Change the kernel page size to 4 KB.
- Choose .

- Press Enter to access the next-level menu, and choose .

- Press Enter to access the next-level menu, and press the space button to choose 4KB.

- Choose Exit twice to save and exit.


- Choose .
- Check whether the page size has been changed to 4 KB.
vi .config
If CONFIG_ARM64_4K_PAGES=y is displayed in the command output, the configuration is successful.

- Overwrite the default configuration file.
cp .config arch/arm64/configs/openeuler_defconfig
Type y.
- Generate the kernel RPM package.
- Install the dependencies.
yum install -y ncurses-devel bc openssl-devel rpm-build bison flex
- Go to the source code root directory.
cp /boot/config-$(uname -r) .
- Compile the RPM package.
make binrpm-pkg -j48
You are advised not to compile the kernel with all cores. For example, for a 64-core processor, run make binrpm-pkg -j48. For a 96-core processor, run make binrpm-pkg -j72. Do not perform other operations during the compilation to avoid suspension.
- View the generated kernel RPM package.
ls /home/rpmbuild/RPMS/aarch64/

- Install the dependencies.
- Install the kernel.
- Upload the generated kernel RPM package to the /home/kernel-rpm directory on the server.
mkdir -p /home/kernel-rpm cd /home/kernel-rpm dnf -y install kernel-4.19.90-1.aarch64.rpm
- Check the default kernel boot items.
grub2-editenv list
- Modify the default kernel boot items.
cat /etc/grub2-efi.cfg | grep openEuler

In the preceding figure, openEuler (4.19.90) 20.03 (LTS-SP1) indicates the newly installed kernel version.
grub2-set-default "openEuler (4.19.90) 20.03 (LTS-SP1)"
- Reboot the system.
1reboot
- Upload the generated kernel RPM package to the /home/kernel-rpm directory on the server.
- After the system is rebooted, run the getconf PAGESIZE command to check whether the page size is 4 KB.
