Skip to content

Commit 4de094e

Browse files
Merge pull request #1976 from jasonrandrews/review
Review the 64k page size Learning Path
2 parents 6fe1dac + 46dca31 commit 4de094e

File tree

5 files changed

+117
-89
lines changed

5 files changed

+117
-89
lines changed

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/_index.md

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: Increasing Linux Kernel Page Size on Arm
2+
title: Explore Performance Gains by Increasing the Linux Kernel Page Size on Arm
33

44
draft: true
55
cascade:
66
draft: true
77

88
minutes_to_complete: 30
99

10-
who_is_this_for: This Learning Path is for developers who want to modify the Linux kernel page size on Arm-based systems to improve performance for memory-intensive workloads.
10+
who_is_this_for: This is an introductory topic for developers who want to modify the Linux kernel page size on Arm-based systems to improve performance for memory-intensive workloads.
1111

1212
learning_objectives:
1313
- Verify the current page size on your system.
@@ -16,20 +16,12 @@ learning_objectives:
1616
- Revert to the default 4K page size kernel (optional).
1717

1818
prerequisites:
19-
- Arm-based Linux system
20-
- Ubuntu [20.04 LTS or newer](https://releases.ubuntu.com/20.04/)
21-
- Debian [11 “Bullseye” or newer](https://www.debian.org/releases/bullseye/)
22-
- CentOS [9 or newer](https://www.centos.org/download/)
19+
- An Arm-based Linux system running Ubuntu, Debian, or CentOS.
2320

24-
author:
25-
- Geremy Cohen
26-
27-
layout: learning-path
2821
author: Geremy Cohen
2922

30-
skill_level: Intermediate
23+
skill_level: Introductory
3124
subjects: Performance and Architecture
32-
cloud_service_providers: Google Cloud
3325

3426
armips:
3527
- Neoverse
@@ -40,23 +32,27 @@ operatingsystems:
4032
tools_software_languages:
4133
- bash
4234

43-
further reading:
44-
- resource:
45-
title: Page (computer memory) – Wikipedia
46-
link: https://en.wikipedia.org/wiki/Page_(computer_memory)
47-
type: documentation
48-
- resource:
49-
title: Debian Kernel Source Guide
50-
link: https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_kernel_source
51-
type: documentation
52-
- resource:
53-
title: Ubuntu Kernel Build Docs
54-
link: https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
55-
type: documentation
56-
- resource:
57-
title: CentOS Kernel Modules Guide
58-
link: https://docs.centos.org/en-US/centos/install-guide/kernel-modules/
59-
type: documentation
35+
further_reading:
36+
- resource:
37+
title: Understanding Memory Page Sizes on Arm64
38+
link: https://amperecomputing.com/tuning-guides/understanding-memory-page-sizes-on-arm64
39+
type: documentation
40+
- resource:
41+
title: Page (computer memory) – Wikipedia
42+
link: https://en.wikipedia.org/wiki/Page_(computer_memory)
43+
type: documentation
44+
- resource:
45+
title: Debian Kernel Source Guide
46+
link: https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_kernel_source
47+
type: documentation
48+
- resource:
49+
title: Ubuntu Kernel Build Docs
50+
link: https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel
51+
type: documentation
52+
- resource:
53+
title: CentOS Documentation
54+
link: https://docs.centos.org/
55+
type: documentation
6056

6157
### FIXED, DO NOT MODIFY
6258
# ================================================================================

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/centos.md

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
---
2-
title: Centos Page Size Modification
2+
title: Change page size on CentOS
33
weight: 5
44
### FIXED, DO NOT MODIFY
55
layout: learningpathall
66
---
77

8-
### Verify current page size
9-
Verify you’re on a 4 KB pagesize kernel by entering the following commands:
8+
Follow the steps below to install a 64K page size kernel on [CentOS 9 or newer](https://www.centos.org/download/).
9+
10+
## Verify the current page size
11+
12+
Verify you’re using a 4 KB pagesize kernel by entering the following commands:
1013

1114
```bash
1215
getconf PAGESIZE
1316
uname -r
1417
```
15-
The output should be similar to below -- the full kernel name may vary, but the first line should always be **4096**:
18+
19+
The output should be similar to below. The kernel flavor (the string after the version number) may vary, but the first line should always be 4096.
1620

1721
```output
1822
4096
@@ -21,15 +25,15 @@ The output should be similar to below -- the full kernel name may vary, but the
2125

2226
The 4096 indicates the current page size is 4KB. If you see a value that is different, you are already using a page size other than 4096 (4K). On Arm systems, the valid options are 4K, 16K, and 64K.
2327

24-
### Install the kernel-64k package:
28+
## Install the 64k kernel package:
2529

26-
Enter the below `dnf` command to install the 64k kernel:
30+
Enter the command below to install the 64k kernel:
2731

28-
```bash
29-
sudo dnf -y install kernel-64k
30-
```
32+
```bash
33+
sudo dnf -y install kernel-64k
34+
```
3135

32-
You should see a page or so of similar output ending with:
36+
You should see a page of output ending with:
3337

3438
```output
3539
...
@@ -40,32 +44,31 @@ Installed:
4044
Complete!
4145
```
4246

43-
### Set the kernel-64k as the default kernel and reboot
44-
45-
Enter the following to set the newly installed 64K kernel as default and reboot:
47+
Enter the following to configure the 64K kernel as default and reboot:
4648

4749
```bash
4850
k=$(echo /boot/vmlinuz*64k)
4951
sudo grubby --set-default "$k" --update-kernel "$k"
5052
sudo reboot
5153
```
5254

53-
### Verify the page size and kernel version:
55+
## Verify the page size and kernel version:
56+
5457
Upon reboot, check the kernel page size and name once again to confirm the changes:
5558

5659
```bash
5760
getconf PAGESIZE
5861
uname -r
5962
```
6063

61-
The output should be similar to below -- like before, the full kernel name may vary, but the first line should always be **65536**:
64+
The output shows the 64k kernel is running:
6265

6366
```output
6467
65536
6568
5.14.0-583.el9.aarch64+64k
6669
```
6770

68-
## Reverting back to the original 4K kernel on CentOS
71+
## Revert back to the 4K kernel
6972

7073
To revert to the original 4K kernel, enter the following:
7174

@@ -103,7 +106,8 @@ Upon reboot, verify you’re on a 4 KB pagesize kernel by entering the following
103106
getconf PAGESIZE
104107
uname -r
105108
```
106-
The output should be similar to below -- the full kernel name may vary, but the first line should always be **4096**:
109+
110+
The output shows the 4k kernel is running:
107111

108112
```output
109113
4096

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/debian.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
11
---
2-
title: Debian Page Size Modification
2+
title: Change page size on Debian
33
weight: 4
44
### FIXED, DO NOT MODIFY
55
layout: learningpathall
66
---
77

8-
Debian does not provide a 64K kernel via apt, so you will need to compile it from source. There are two ways to do this: 1) download the source from the kernel.org website, or 2) use the Debian source package. This guide will use the Debian source package.
8+
Follow the steps below to install a 64K page size kernel on [Debian 11 “Bullseye” or newer](https://www.debian.org/releases/bullseye/).
99

10-
### Verify current page size
11-
Verify you’re on a 4 KB pagesize kernel by entering the following commands:
10+
Debian does not provide a 64K kernel package, so you will need to compile it from source.
11+
12+
There are two ways to do this:
13+
- Download the source from kernel.org.
14+
- Use the Debian source package.
15+
16+
The instructions below use the Debian source package.
17+
18+
## Verify the current page size
19+
20+
Verify you’re using a 4 KB pagesize kernel by entering the following commands:
1221

1322
```bash
1423
getconf PAGESIZE
1524
uname -r
1625
```
17-
The output should be similar to below -- the full kernel name may vary, but the first line should always be **4096**:
26+
27+
The output should be similar to below. The kernel flavor (the string after the version number) may vary, but the first line should always be 4096.
1828

1929
```output
2030
4096
@@ -23,20 +33,20 @@ The output should be similar to below -- the full kernel name may vary, but the
2333

2434
The 4096 indicates the current page size is 4KB. If you see a value that is different, you are already using a page size other than 4096 (4K). On Arm systems, the valid options are 4K, 16K, and 64K.
2535

26-
### Install from Debian Source Package
36+
## Install the Debian kernel source package
2737

28-
To install a 64K page size kernel via package manager, follow these steps:
38+
Follow the steps below to install a 64K kernel using the Debian kernel source package.
2939

30-
First, update, and install dependencies:
40+
First, update, and install the required software:
3141

3242
```bash
3343
sudo apt-get -y update
3444
sudo apt-get -y install git build-essential autoconf automake libtool libncurses-dev bison flex libssl-dev libelf-dev bc debhelper-compat rsync
3545
```
3646

37-
Download the kernel and cd to its directory:
38-
```bash
47+
Download the kernel source and cd to its directory:
3948

49+
```bash
4050
# Fetch the actual kernel source
4151
apt source linux
4252
# Change to kernel source dir
@@ -46,6 +56,7 @@ cd -- linux*/
4656
## Build and install the kernel
4757

4858
Now that you have the kernel source, follow these steps to build and install the kernel:
59+
4960
```bash
5061
# Use running config as template for new config
5162
cp /boot/config-$(uname -r) .config
@@ -70,25 +81,28 @@ sudo dpkg -i linux-image-*64k*.deb linux-headers-*64k*.deb
7081
```
7182

7283
The system is now ready to reboot:
84+
7385
```bash
7486
sudo reboot
7587
```
88+
7689
Upon reboot, check the kernel page size and name once again to confirm the changes:
7790

7891
```bash
7992
getconf PAGESIZE
8093
uname -r
8194
```
8295

83-
The output should be similar to below -- like before, the full kernel name may vary, but the first line should always be **65536**:
96+
The output shows the 64k kernel is running:
8497

8598
```output
8699
65536
87100
6.12.22-64k
88101
```
102+
89103
This indicates the current page size is 64K, and you are using the new custom made 64k kernel.
90104

91-
## Reverting back to the original 4K kernel
105+
## Revert back to the 4K kernel
92106

93107
To revert back to the kernel we started with, enter:
94108

@@ -105,6 +119,7 @@ Upon reboot, verify you’re on a 4 KB pagesize kernel by entering the following
105119
getconf PAGESIZE
106120
uname -r
107121
```
122+
108123
The output should be similar to below -- the full kernel name may vary, but the first line should always be **4096**:
109124

110125
```output

content/learning-paths/servers-and-cloud-computing/arm_linux_page_size/overview.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,32 @@ weight: 2
55
layout: learningpathall
66
---
77

8-
## How the CPU Locates Your Data
8+
## How does the CPU locate data in memory?
99

1010
When your program asks for a memory address, the CPU doesn’t directly reach into RAM or swap space for it; that would be slow, unsafe, and inefficient.
1111

12-
Instead, it goes through the **virtual memory** system, where it asks for a specific chunk of memory called a **page**. Pages map virtual memory location to physical memory locations in RAM or swap space.
12+
Instead, it goes through the virtual memory system, where it asks for a specific chunk of memory called a page. Pages map virtual memory locations to physical memory locations in RAM or swap space.
1313

14-
## What’s a Memory “Page”?
14+
## What’s a memory page?
1515

16-
Think of your computer’s memory like a big sheet of graph paper. Each **page** is one square on that sheet. The **page table** is the legend that tells the computer which square (virtual address) maps to which spot in real RAM. On x86, 4K is the only pagesize option, but Arm-based systems allow you to set 4K, 16K, or 64K page sizes to fine tune performance of your applications. This tutorial only covers switching between 4K and 64K page sizes.
16+
Think of your computer’s memory like a big sheet of graph paper. Each page is one square on that sheet. The page table is the legend that identifies which square (virtual address) maps to which spot in physical RAM. On x86, 4K is the only page size option, but Arm-based systems allow you to use 4K, 16K, or 64K page sizes to fine tune the performance of your applications.
1717

18+
This Learning Path explains how to switch between 4K and 64K pages on different Linux distributions.
1819

19-
## When to Choose Which
20+
## How should I select the memory page size?
2021

21-
- **4 KB pages** are the safe, default choice. They let you use memory in small slices and keep waste low. Since they are smaller, you need more of them when handling larger memory footprint applications. This creates more overhead for the CPU to manage, but may be worth it for the flexibility. They are great for applications that need to access small bits of data frequently, like web servers or databases with lots of small transactions.
22+
Points to consider when thinking about page size:
2223

23-
- **64 KB pages** shine when you work with big, continuous data—like video frames or large database caches—because they cut down on management overhead. They can waste more memory if you don’t use the whole page, but they can also speed up access times for large data sets.
24+
- **4K pages** are the safe, default choice. They let you use memory in small slices and keep waste low. Since they are smaller, you need more of them when handling larger memory footprint applications. This creates more overhead for the operating system to manage, but it may be worth it for the flexibility. They are great for applications that need to access small bits of data frequently, like web servers or databases with lots of small transactions.
2425

25-
When rightsizing your page size, its important to **try both** under real-world benchmarking conditions, as it will depend on the data size and retrieval patterns of the data you are working with. In addition, the page size may need to be adjusted over time as the application, usage patterns, and data size changes. Althoug this tutorial only covers switching between 4K and 64K page sizes, you can see from the below table that in some cases, you may find a sweet spot in between 4K and 64K at a 16K page size:
26+
- **64K pages** shine when you work with large, continuous data such as video frames or large database caches because they cut down on management overhead. They will use more memory if you don’t use the whole page, but they can also speed up access times for large data sets.
2627

28+
When selecting your page size, it's important to try both options under real-world conditions, as it will depend on the data size and retrieval patterns of the data you are working with.
29+
30+
In addition, the page size may need to be reviewed over time as the application, memory usage patterns, and data sizes may change.
31+
32+
33+
### Summary of page size differences
2734

2835
| Aspect | 4K Pages | 64K Pages |
2936
|-----------------|--------------------------------------|----------------------------------------|
@@ -32,18 +39,18 @@ When rightsizing your page size, its important to **try both** under real-world
3239
| **Efficiency** | Needs more entries (more bookkeeping) | Needs fewer entries (less bookkeeping) |
3340
| **Waste** | At most 4 KB unused per page | Up to 64 KB unused if not fully used |
3441

35-
##### Summary of page size differences
42+
This Learning Path covers switching between 4K and 64K page sizes because these are supported by most Arm Linux distributions. In some cases, you may find that 16K page size is a sweet spot for your application, but Linux kernel, hardware, and software support is limited. One example of 16k page size is [Asahi Linux](https://asahilinux.org/).
3643

3744
## Experiment to see which works best for your workload
45+
46+
The best way to determine the impact of page size on application performance is to experiment with both options.
47+
3848
{{% notice Do not test on Production%}}
3949
Modifying the Linux kernel page size can lead to system instability or failure. Perform testing in a non-production environment before applying to production systems.
4050
{{% /notice %}}
4151

42-
This learning path will guide you how to change (and revert back) the page size, so you can begin experimenting to see which fits best. The steps to install the 64K page size kernel are different for each OS, so be sure to select the correct one.
43-
52+
Select the Arm Linux distribution you are using to find out how to install the 64K page size kernel.
4453

45-
- [Ubuntu](../ubuntu)
46-
- [Debian](../debian)
47-
- [CentOS](../centos)
48-
49-
---
54+
- [Ubuntu](/learning-paths/servers-and-cloud-computing/arm_linux_page_size/ubuntu/)
55+
- [Debian](/learning-paths/servers-and-cloud-computing/arm_linux_page_size/debian/)
56+
- [CentOS](/learning-paths/servers-and-cloud-computing/arm_linux_page_size/centos/)

0 commit comments

Comments
 (0)